Added comments and redirected cout to a file