use only 1 loop