Added comments and docstring