Added code to generalize the contig operations