More optimizations of the melm matching.