simplify loop