end and begin lookahead funtions are implemented