mior changes
corrected matrix multiplications