restructure to functions

Also modify vtundsrv encrypt if Linksys