fixed Issue #3, added tests with full expected results
updated doc