added reduce and toValue