Some changes in preparation for a working version of EMR mode