a bit of refactoring for ann
decreased convergence threshold