Initial commit of SMM with refactored code from EasyEMR