implement all the function of the reduction
but it is still not working