Remove unneeded AND operations