Simplified JS a bit.