refactor the modified cat implementation in the transducer example