This function is not intended for use by user. It is instead called upon by the MDS-GUI.
Note
This function was found to be most effiecient when treated as an individual function and not nested within the MDSgui function. The function should not be used independantly.