first try to implement reduce , not finished yet