change javascript init to be able to test in browser