Some ported stuff from cm-10.2 to cm-11.0