some refactoring, add several methods