Cleaned up some of the UI code to make it more readable
Refactored some of the ui.rb code