Externalize javascript