refactored to allow setting a code directly