moved the gui setup code to if __name__ == '__main__' and dissolved the initgui function
added comments