updated documentation and code