Added needed functionality to manage automatically internal_reference_no field