Added dimensions in k and fixed output