Refactored scope mapper.