extract function handling in Mapper into own class