added data-dependent epsilon calculation