Cleaned up, no data storage in the main function, just in the
mex file.