do some refactorings