Added support for backward pattern matching
Added support for backward pattern matching