Created functions to handle scenarios in mapper