Add getRegCode function for #18