Improved fold with mealy