making a new version aimed to be entirely written in MATLAB