cleanup current state of upsert functionality.

- one less loop
- a little cleanup.