Refactoring ahead of splitting off a library