3D Functionality for y1,y2,z1,z2 added, but to be tested.