beginning changes to the JS module for chatting