Substantially rewrote to make more accurate