refactor for loop in dispatch expr

we can always undo this but i think it is more readable this way