Newton method implemented