More sensible get_code func.