version i submitted, but there is a bug in parallel code: make the dx a parameter