Moved JS to a plugin format