added main chat functionality