updated script to sleep after messaging