Fix for IPv4-only DBs
More error checking
Much needed decoder code reorg