More work on upsert