Ratchet implementation