Used Netbeans code formatter to tidy up