Refactor the resolv module