Working mscomplex main code