a bit more gentle refactoring