Added test and improved documentation.