Refactor to for-in expression