Enable a few more warnings and fix code accordingly
Simplify code for IP lookup