[#6] Changed strategy by looking at extension first, then at grammar