control loop

controls one loop, so its no longer infinits