Updated to allow min of 1 (instead of 2) for $or and $and