added gzip directives and cleanup of processing