Ply function implemented correctly