some refactoring for better usage