fixing the problems with the match cases. works now on test data up to 10