added an optional (i think, at least) flag for stopping early.