Refactored and updated version of cmEditDemo