anchor.diff:              match loop with
               | Idle(handle, wakeup) -> let memory = new MemoryPool()
                                         loop <- LoopState.Running(handle, wakeup, memory)
  -                                      handle.Init(libuv)
  -
  -                                      let create(token: int64, fsm: Machine<'c>) = fsm.init handle (fun () -> runOnce token fsm fsm.machine.timeout)
  -                                                                                   runOnce token fsm fsm.machine.create
  -
  -                                      //Deqeue at most l items
  -                                      //This is to make sure other events this loop iteration get a chance to run
  -                                      let rec dequeueAtMost l =  match l with
  -                                                                 | 0 -> ()
  -
  -                                                                 | _ -> match wakeup.dequeue with
  -                                                                        | true, token -> match (Map.tryFind token machines) with
  -                                                                                         | Some(fsm) -> match fsm.state with
  -                                                                                                        //Wakeups may get called on Uninitialised machines
  -                                                                                                        //We only run this check for wakeups
  -                                                                                                        | MachineState.Uninitialised -> create(token, fsm)
  -                                                                                                        | MachineState.Running -> ()
  -
  -                                                                                                        runOnce token fsm fsm.machine.wakeup
  -                                                                                         | _ -> ()
  -
  -                                                                                         dequeueAtMost (l - 1)
  -
  -                                                                        | false, _ ->    ()
  -
  -                                      //Initialise wakeup mechanism
  -                                      let handleWakeup () = dequeueAtMost (wakeup.length)
  -
  -                                                            match wakeup.length with
  -                                                            | 0 -> ()
  -                                                            | _ -> wakeup.wakeup
  -
  -                                      wakeup.init handle handleWakeup
  -
  -                                      //Initialise machines and timer callbacks
  -                                      machines |> Map.iter(fun token fsm -> match fsm.state with
  -                                                                            | MachineState.Uninitialised -> create(token, fsm)
  -                                                                            | MachineState.Running -> ())
  +
  +                                      init handle wakeup memory
   
                                         match machines.Count with
                                         | 0 -> 0
  
positive.code:             | 0 -> stop()
              | _ -> ()
  
          let runOnce token (fsm: Machine<'c>) f =
              match loop with
              | Running(loop, wakeup, memory) -> let scope = Scope(token, loop, wakeup, memory)
  
negative.code: 
              | Idle(_, _) ->                    ()
              
          /// Initialise loop internals.
          /// 
          /// This assumes internals are currently uninitialised.
          let init (handle: UvLoopHandle) (wakeup: WakeupHandle) (memory: MemoryPool) =
              handle.Init(libuv)
  
              let create(token: int64, fsm: Machine<'c>) = fsm.init handle (fun () -> runOnce token fsm fsm.machine.timeout)
                                                           runOnce token fsm fsm.machine.create
  
              let wakeupMachine token = match (Map.tryFind token machines) with
                                        | Some(fsm) -> match fsm.state with
                                                       //Wakeups may get called on Uninitialised machines
                                                       //We only run this check for wakeups
                                                       | MachineState.Uninitialised -> create(token, fsm)
                                                       | MachineState.Running -> ()
  
                                                       runOnce token fsm fsm.machine.wakeup
                                        | _ -> ()
              //Deqeue at most l items
              //This is to make sure other events this loop iteration get a chance to run
              let rec dequeueAtMost l =  match l with
                                         | 0 -> ()
  
                                         | _ -> match wakeup.dequeue with
                                                | true, token -> wakeupMachine token
                                                                 dequeueAtMost (l - 1)
  
                                                | false, _ ->    ()
  
              //Initialise wakeup mechanism
              let handleWakeup () = dequeueAtMost (wakeup.length)
  
                                    match wakeup.length with
                                    | 0 -> ()
                                    | _ -> wakeup.wakeup
  
              wakeup.init handle handleWakeup
  
              //Initialise machines and timer callbacks
              machines |> Map.iter(fun token fsm -> match fsm.state with
                                                    | MachineState.Uninitialised -> create(token, fsm)
                                                    | MachineState.Running -> ())
  
          /// Add a generic `IMachine<'c>` to the loop.
          /// 
          /// This can only be done if the loop is in the `Idle` state.
          member this.addMachine (f: EarlyScope -> 'a) =
              match loop with
              | Idle(handle, wakeup) -> let token = int64 machines.Count
                                        let scope = EarlyScope(token, handle, wakeup)
                                        let machine = f scope
  
                                        let machine = new Machine<'c>((machine :> IMachine<'c>), new UvTimerHandle())
                                        machines <- machines |> Map.add token machine
  
              | Closed ->               raise (NotImplementedException("Adding machines to dirty loops is not implemented"))
  
              | Running(_, _, _) ->     raise (NotImplementedException("Adding machines to running loops is not implemented"))
  
          /// Run the loop.
          /// 
  