gui code cleanup