Added some comments and improved the output