edits on transpose_matrix function