Refactored printCode to decode