Added code for transposing larger matrices