var declarations moved out of loop
`through` not always defined on associations