It sounds like you may have a potential buffer problem. At the end of your while loop, try making phrase equal to a blank phrase. It will clear the buffer and and help avoid any unnecessary inputs.