setCode method