Didn't realize it was using a char before. This is the correct fix for the infinite loop, and also resolves the excessive CPU usage issue encountered previously.