refactor map