Implement match-function