moved methods Set to for loop scope to avoid side effects