Refactor map generator.

- Change format to JSON for easier parsing
- Refactor code into a class for easier variable management
- Migrate old conf file to JSON
- Change program flow slightly, using exceptions
Merge