Small improvement in loop