Refactored the js-file.