Switch to relative function values for assessing convergence

Respect input vector type
General code cleanup