Rework and optimise the XFace/CFace code.