mealy functionality