added unit tests. improved documentation. refactored `yield` method