consolidating function and condition for name not