Code clean up and formatting + added some comments and output