refactoring in lecture demo almost merged.