Changed the selector parsing from being iterator driven to state driven.