Fixed formatting and used some Java 7 capabilities to improve the code
Reformat code for readability and introduce some Java 7 cleanups