replaced -1000 with Double.NEGATIVE_INFINITY