Refactored + added varnish 3 support