Updated to cope with multiple conditions on the same key (e.g. ranges)