refactor map parser