Neatened the code to conform to coding guidelines.