changed line break for script to be inside the if statement