Added a simple timeout mechanism to prevent an infinite loop of no 
changes.