refactoring was actually ex 4.12, finished