Making changes to run on Matlab 2012a