adapting it for CM?
returned inline that somehow caused errors previously