some refactoring code