updated script to support updating each table when needed