Added logging to chat function. Not quit working yet. Permission problems.