Factoring out user interface code into its own file