Added logic for when to add scripts