refactor user scripts for exiting on db errors