added initial flag detection, performance shows its MUCH faster to perform after indexing all blocks rather then as the blocks are parsed.