Making attach idempotent and cursor type configurable