Added some improvements on database mapreduces