new working mapper code