Added the history field check to all WHERE