Handle foreach