refactoring `map` to use append!