removed debugging lines and added docstring