Some work on a Chat handler and bugfixes