first draft idempotent implementation