converted to class instead of having a function
match method added