refactored tuntap plugin