Freed TickEvents after they're dispatched
Added ReferenceManager
Continuation of commit 0094564
Switched to using context everywhere