do some refactor work