Source code janitor work

- MainForm.cs is now split up in regions.
- Some duplicate code has been removed.