OnPush refactoring into common functions.
Refactoring done.
Basic tests completed.