Correct sense of match and move the code up to since it makes more sense