Removed getX function and fixed small bugs in update_Z
Removed debugging stuff