added lookahead parameter