Improved comments.
Bug fixes and cleanup.