Adding chat logic