There is no need to use sqrt()/INFINITY here which simplifies the code