Better grep matching

Both on speed and accuracy.