updated documentation and example code.