add map function and tests