moved netlink setup to a separate function and got rid of all global variables