[cyril] moved match-3 related code out.