Execute script outside loop