simplify JS a bit w/ correct function call