added more comments, formatted to follow pep8