add realtime functionality related to messages, refactor all js to be more modularized
remove unused code