added docstring; minor changes