added tests, edge cases
updated documentation