removed debug prints and added a little docstring