update the genFirst Function