Modified script so its easy to kill if something goes wrong.