Refractored a lot of things

Changed to IntelliJ IDEA, so followed most of it's suggestions.