feature:keep maximized windows after reopening them, code cleanup: using helper functions