some refactoring in progress