making scripts run only once instead of looping