slight refactoring