Created calculate_MSSI() function and homogenised the code; added some more documentation to both functions