gui patterns and some clean up