refactoring, tests, output coercion based on input type

also, I remembered out the point of keep - it combines map and filter identity into one function