modified script to run in the background