Working on making auth and db write atomic