clean up ipv4 code a bit