Formatting and comments added, partially