restructured the userinterface code