make some refactor code