Massive cleanup of MainForm code