Refactored Match.java typechecking. Refactored test cases to use a few
helper methods.