reworked ChatEngine's main command loop