Adding some optimizations for vhost