Refactor floating matches to rules