Updated newton's method