Work-in-progress commit of rem support.  Not tested properly at the moment.