a bit of refactoring in 1643