Move the javascript init from the constructor