vhost.pp: refactor and remove redundancies