Clean up, update documentation and add monadic fold