Add basic reduce function