do some refactor work.