Added guard statements to the scripts.