Formatting
Removed obsolete code
Added some functionality
Added code to convert between UI coordinates and normal coordinates