cleaned and looped script