remove unnecessary return of key in loop