Implementing mapper and reducer, needs improvement