Added debug print to registerCode