Better implementation of setAnd.