adding 1st version of loop with serial control