first attempt for a unifying generic newton implementation.