implemented control loop PRE_LOOP routine