Moving detection of new variables to tests for new variables to avoid re-evaluating user's expression every time.