added docstring comments, variable name cleanup