work in progress

upsert almost ready, but not test yet.