This should fix issue #4

You weren't storing the lastX, lastY and lastZ values.