mex improvements