readded scaling function to map from ephemeral port range to 0. - 1.
fixed bugs in scale function and calling of scale function