Made a nicer implementation of reduction functions