Ecg simulator refactoring