This is quite messy. Group functions and variables by their visibility and if they're instances or not.

Also consider extracting everything away from your Main class into a separate class that's easier to use. Putting functionality into the Main class can be the start of an unholy mess. Advice I always try to keep in ming:

Your main function should tell you what the program does, not how it does it.