added comments and calculations
added comment explaining the program