Refactored code for GUI root frame