refactor map callback