add some refactoring