changed single line format of functions for readability, edited comments