Refactor feature matching a bit