Started refactoring matching to incorporate datastructure for matching
directives.