GUI code cleanup