Major changes in architecture. Removed most global objects. Implemented an event dispatcher, etc.