Code organization improvements in MainForm.