Reformatted and cleaned up a bunch of code using IntelliJ IDEA.