Improved the comments and modified the program output.