Included code for reduce