Minor corrections. Added some docstrings.