Refactor codes.