adding comments and formatting of code