added logging on reduce() method