Reformatted the code using Intellij IDEA.