Fixed infinite loop; Improved performance (5%).