Move this to the top, and then you don't need to explicitly "print" and "next" in each match.