added chat support and improved example