[m] Same changes as in recent commit in the core, some renaming of functions