moved getfirst logic to map_reduce from getfirst mapper/reducer