I totally agree! I extracted it in a separate js.