Implemented permute and transpose