Adding docstring and cleaning