refactor the update function, split update_db.py to multiple files