trying to add in a periodic loop