removed comments, renamed had_err_2 to valid_contig