Changing logic in transpose - it wasn't working for matrices with more columns than rows