fixing code formatting and comments