More progress on matching and added unit tests.