updated based on Emr module refactoring