loop imporvements, moved keys