cleanup in chat app
stricter parsing
exiting the loop now works and doesn’t throw exception