Changed REST api and chat func