Use (>>=) rather than 'substitute'.
Missed case in 'reduce'.