diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,9 @@
 
+Version 0.7
+-----
+
+* Introduced the discrete event priorities.
+
 Version 0.6
 -----
 
diff --git a/Simulation/Aivika/Lattice/Internal/Estimate.hs b/Simulation/Aivika/Lattice/Internal/Estimate.hs
--- a/Simulation/Aivika/Lattice/Internal/Estimate.hs
+++ b/Simulation/Aivika/Lattice/Internal/Estimate.hs
@@ -57,9 +57,6 @@
 
 instance Monad m => Monad (Estimate m) where
 
-  {-# INLINE return #-}
-  return a = Estimate $ \p -> return a
-
   {-# INLINE (>>=) #-}
   (Estimate m) >>= k =
     Estimate $ \p -> 
diff --git a/Simulation/Aivika/Lattice/Internal/Event.hs b/Simulation/Aivika/Lattice/Internal/Event.hs
--- a/Simulation/Aivika/Lattice/Internal/Event.hs
+++ b/Simulation/Aivika/Lattice/Internal/Event.hs
@@ -21,7 +21,7 @@
 import Control.Monad
 import Control.Monad.Trans
 
-import qualified Simulation.Aivika.PriorityQueue.Pure as PQ
+import qualified Simulation.Aivika.PriorityQueue.EventQueue.Pure as PQ
 
 import Simulation.Aivika.Trans
 import Simulation.Aivika.Trans.Internal.Types
@@ -52,11 +52,11 @@
                               queueBusy = f,
                               queueTime = t }
 
-  enqueueEvent t (Event m) =
+  enqueueEventWithPriority t priority (Event m) =
     Event $ \p ->
     let pq = queuePQ $ runEventQueue $ pointRun p
     in invokeEvent p $
-       R.modifyRef pq $ \x -> PQ.enqueue x t m
+       R.modifyRef pq $ \x -> PQ.enqueue x t priority m
 
   runEventWith processing (Event e) =
     Dynamics $ \p ->
@@ -104,8 +104,8 @@
        f <- invokeLIO ps $
             fmap PQ.queueNull $ R.readRef0 pq
        unless f $
-         do (t2, c2) <- invokeLIO ps $
-                        fmap PQ.queueFront $ R.readRef0 pq
+         do (t2, priority2, c2) <- invokeLIO ps $
+                                   fmap PQ.queueFront $ R.readRef0 pq
             let t = queueTime q
             t' <- invokeLIO ps $
                   R.readRef0 t
@@ -118,6 +118,7 @@
                      dt = spcDT sc
                      n2 = fromIntegral $ floor ((t2 - t0) / dt)
                      p2 = p { pointTime = t2,
+                              pointPriority = priority2,
                               pointIteration = n2,
                               pointPhase = -1 }
                  invokeLIO ps $
diff --git a/Simulation/Aivika/Lattice/Internal/LIO.hs b/Simulation/Aivika/Lattice/Internal/LIO.hs
--- a/Simulation/Aivika/Lattice/Internal/LIO.hs
+++ b/Simulation/Aivika/Lattice/Internal/LIO.hs
@@ -70,9 +70,6 @@
 
 instance Monad LIO where
 
-  {-# INLINE return #-}
-  return = LIO . const . return
-
   {-# INLINE (>>=) #-}
   (LIO m) >>= k = LIO $ \ps ->
     m ps >>= \a ->
@@ -81,7 +78,7 @@
 instance Applicative LIO where
 
   {-# INLINE pure #-}
-  pure = return
+  pure = LIO . const . pure
 
   {-# INLINE (<*>) #-}
   (<*>) = ap
@@ -224,7 +221,7 @@
 latticePoint =
   Parameter $ \r ->
   do t <- invokeParameter r latticeTime
-     return $ pointAt r t
+     return $ pointAt r t 0
 
 -- | Return the lattice time step.
 latticeTimeStep :: Parameter LIO Double
diff --git a/Simulation/Aivika/Lattice/Internal/Lattice.hs b/Simulation/Aivika/Lattice/Internal/Lattice.hs
--- a/Simulation/Aivika/Lattice/Internal/Lattice.hs
+++ b/Simulation/Aivika/Lattice/Internal/Lattice.hs
@@ -36,7 +36,7 @@
 -- from the right parent.
 newRandomLatticeWithProb :: Double -> Int -> IO LIOLattice
 newRandomLatticeWithProb p m =
-  do g <- MWC.withSystemRandom (return :: MWC.GenIO -> IO MWC.GenIO)
+  do g <- MWC.createSystemRandom
      xss0 <- forM [0 .. m] $ \i ->
        do xs0 <- forM [0 .. i] $ \k ->
             if k == 0
diff --git a/aivika-lattice.cabal b/aivika-lattice.cabal
--- a/aivika-lattice.cabal
+++ b/aivika-lattice.cabal
@@ -1,5 +1,5 @@
 name:            aivika-lattice
-version:         0.6.2
+version:         0.7
 synopsis:        Nested discrete event simulation module for the Aivika library using lattice
 description:
     This experimental package extends the aivika-transformers [1] library and allows 
@@ -11,10 +11,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-lattice
 cabal-version:   >= 1.10
 build-type:      Simple
 tested-with:     GHC == 7.10.3
@@ -56,8 +56,8 @@
                      containers >= 0.4.0.0,
                      random >= 1.0.0.3,
                      mwc-random >= 0.13.1.0,
-                     aivika >= 5.9.1,
-                     aivika-transformers >= 5.9.1
+                     aivika >= 6.0.0,
+                     aivika-transformers >= 6.0.0
 
     other-extensions:   TypeFamilies,
                         MultiParamTypeClasses,
@@ -71,4 +71,4 @@
 source-repository head
 
     type:     git
-    location: https://github.com/dsorokin/aivika-lattice
+    location: https://gitflic.ru/project/dsorokin/aivika-lattice
