Updated moppy replacement code (woefully incomplete!).