refactor codes from the instruction