refactor of form to MainForm