removed unnecessary helper function. and tested against 10000 values.