Move match to where it's needed