some refactoring work