Many changes to Main.java

Didn't commit for a while, oops.