thorough pseudocode in gff_tests