Improved IP parsing