some refactoring to have better currying. finalized upsertVRID