Cleaned up code, continuing MainForm functionality