add deletion logic and fix the ratchet diagram