refactor match class