Reassign Z as forward/back and remove debug code