some refactorings