Infinite while loop issue fixed.