Bug fixes.
Added documentation.