adding better warning logic