Simplified logic by passing last-touched coordinates rather than separate x y and z data