Chat class rework, database support