Also fixed IP logic because this was real messed up
Welp. All that for this.
I forgot to close this one earlier, so:
Mostly for performances reasons.
First one to implement threading later.
Second one to speed up the dichotomy,
but it doesn't seem that much better so far.