Code from the original version of get2cme