Several updates.

Made some work on UI. Cleaned up some of the code and improved it. Added events to the input system.