updated the db and logic