optimize import and auto refactor codes