MATLAB code cleanup