Implemented chat interface and function, addressed bugs