Full look-ahead code now implemented.