made some tweaks to addUser function to insert/update db depending on current state