some refactoring made