Refactor out map parser