without 2nd loop