Moved the varnish logic into a module