Seperated js and HTML added code for communication