added more js for chat functionality