Updated variable check to be more sensible