Simplify the JS a little