added chat functionality and fixed quirk with user context