1) Added codes in the Reducer Function to make it more memory efficient