resolves #8, all tests pass