Completed loops with shorter code