Updated for changes to dA, and debugging.