Correct use of reduce