Take F(x) as argument so that it's only calculated once per iteration.