Added dependency to the makefiles, and fixed a memory leak issue with the map/reduce methods