Refactore DHCP lease code