Reimplement lookAheadE

Including tests.