lots of little updates; added emulated upsert