fixed upsert issue
final tweaks
more final tweaks