Fixed flicker in menus, slight code restructuring.