Refactored UI code into its own file, fixed bug with startup page