Do some refactor