Improve way of calculating highest IP
Correct algorithm for working out highest allocatable IP