Added comments and minor changes to output