add documentation and some enhancements