Clearer iteration through keys

- We needed to closure the variable `levels` and this is cleaner