Adding docstring and comments