Code cleanup for MainFrame rendering