Refactored UI into its own class