some refactoring;