Moved JS

Moved JS to a shared file.