Refactor map validation