Refactor some part of code.