A bit of refactoring [ci skip]