switching loops works