cleanup and documentation
fix tests