reworked code to handle matchClass use-case