updates and added transpose function