revised mapper & reducer