refactored frame maximize code a little