adds completed functioning method 'match'