we can probably move these into local variables since they're being called twice in a loop