Streamlined main algorithm. Updated documentation and tests.