Change dependency library on libvirt and refactor code