Implemented transpose() method.