added tests, fixed whereing