#31 implemented the javascript part