Syntax and bug fixes. Also added significant documentation via comments and updated docstrings.