fixed bug where menu_visibility wasn't set correctly
added comments and capitalized globals