Move code into function  assign_labels_to_src()