testing against the 1D javascript code.  got things working a bit better, but still has problems