fixed to the point that it is running for a while. Still should check to make sure end condition is logically correct.