refactor part code