extracting third shared js
cleaned code