dx removed and code working

Seems to work really well with 2000 iterations.