do some refactoring