added port of gene-check code