Refactoring

Buttons, menus, editorhud and resizablebox all work properly again.
Cleaned up code close to a formatting standard.