removed faulty reduce implementation