WiP - shared code refactoring