Add Tern for JS, minor cleanups