optimize for in statements