improved documentation
added tests