added explanation to the equation
merged some work