refactor the js

Just organized it better and add "; " to javascript