Some code clean up

GUI functions moved into its own .cpp file