diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,9 @@
 
+Version 0.4
+-----
+
+* Introduced the discrete event priorities.
+
 Version 0.3
 -----
 
diff --git a/Simulation/Aivika/RealTime/Internal/Event.hs b/Simulation/Aivika/RealTime/Internal/Event.hs
--- a/Simulation/Aivika/RealTime/Internal/Event.hs
+++ b/Simulation/Aivika/RealTime/Internal/Event.hs
@@ -23,7 +23,7 @@
 import Control.Monad.Trans
 import Control.Exception
 
-import qualified Simulation.Aivika.PriorityQueue as PQ
+import qualified Simulation.Aivika.PriorityQueue.EventQueue as PQ
 
 import Simulation.Aivika.Trans
 import Simulation.Aivika.Trans.Internal.Types
@@ -58,10 +58,10 @@
                              queueTime = t,
                              queueStartUTCTime = t0 }
 
-  enqueueEvent t (Event m) =
+  enqueueEventWithPriority t priority (Event m) =
     Event $ \p ->
     let pq = queuePQ $ runEventQueue $ pointRun p
-    in liftIO $ PQ.enqueue pq t m
+    in liftIO $ PQ.enqueue pq t priority m
 
   runEventWith processing (Event e) =
     Dynamics $ \p ->
@@ -114,7 +114,7 @@
        -- proceed with processing the events
        f <- liftIO $ PQ.queueNull pq
        unless f $
-         do (t2, c2) <- liftIO $ PQ.queueFront pq
+         do (t2, priority2, c2) <- liftIO $ PQ.queueFront pq
             let t = queueTime q
             t' <- liftIO $ readIORef t
             when (t2 < t') $ 
@@ -131,6 +131,7 @@
                                dt = spcDT sc
                                n2 = fromIntegral $ floor ((t2 - t0) / dt)
                                p2 = p { pointTime = t2,
+                                        pointPriority = priority2,
                                         pointIteration = n2,
                                         pointPhase = -1 }
                            liftIO $ writeIORef t t2
diff --git a/Simulation/Aivika/RealTime/Internal/RT.hs b/Simulation/Aivika/RealTime/Internal/RT.hs
--- a/Simulation/Aivika/RealTime/Internal/RT.hs
+++ b/Simulation/Aivika/RealTime/Internal/RT.hs
@@ -80,9 +80,6 @@
 
 instance Monad m => Monad (RT m) where
 
-  {-# INLINE return #-}
-  return = RT . const . return
-
   {-# INLINE (>>=) #-}
   (RT m) >>= k = RT $ \ctx ->
     m ctx >>= \a ->
diff --git a/aivika-realtime.cabal b/aivika-realtime.cabal
--- a/aivika-realtime.cabal
+++ b/aivika-realtime.cabal
@@ -1,5 +1,5 @@
 name:            aivika-realtime
-version:         0.3.1
+version:         0.4
 synopsis:        Soft real-time simulation module for the Aivika library
 description:
     This package allows running soft real-time simulations based on the aivika-transformers [1] library.
@@ -9,10 +9,10 @@
 category:        Simulation
 license:         BSD3
 license-file:    LICENSE
-copyright:       (c) 2016-2017. David Sorokin <david.sorokin@gmail.com>
+copyright:       (c) 2016-2023. David Sorokin <davsor@mail.ru>
 author:          David Sorokin
-maintainer:      David Sorokin <david.sorokin@gmail.com>
-homepage:        http://www.aivikasoft.com
+maintainer:      David Sorokin <davsor@mail.ru>
+homepage:        https://gitflic.ru/project/dsorokin/aivika-realtime
 cabal-version:   >= 1.10
 build-type:      Simple
 tested-with:     GHC == 7.10.3
@@ -47,8 +47,8 @@
                      async >= 2.0,
                      time >= 1.5.0.1,
                      vector >= 0.10.0.1,
-                     aivika >= 5.9.1,
-                     aivika-transformers >= 5.9.1
+                     aivika >= 6.0.0,
+                     aivika-transformers >= 6.0.0
 
     other-extensions:   TypeFamilies,
                         MultiParamTypeClasses,
@@ -63,4 +63,4 @@
 source-repository head
 
     type:     git
-    location: https://github.com/dsorokin/aivika-realtime
+    location: https://gitflic.ru/project/dsorokin/aivika-realtime
