minor organization, docstring formatting and removed use of python keyword "file"