code  refactor