do some refactor