Simplifies the implementation of and_ and or_.

Also enhances parameter validation.