refactor map databases