moving expensive lookups to a slower iteration