changed condition on epsilon to allow 0
#2 added methods which help to select suitable epsilon