Add optional reference counting to KeyMaker