Updated script for updating database