Added comments and formatting.