MX-1133, some simple refactoring to enable code reuse