Correction to matrix transpose. Update to memory handling.