added matrix transposition