added support for firstMatch rule