changed dW to be consistent for X and M