Refactor map check