(refactor) sendCode