diff --git a/rhodecode/controllers/changeset.py b/rhodecode/controllers/changeset.py
--- a/rhodecode/controllers/changeset.py
+++ b/rhodecode/controllers/changeset.py
@@ -267,8 +267,10 @@ class ChangesetController(BaseRepoContro
                     repo_name=c.repo_name,
                     source_node_getter=_node_getter(commit1),
                     target_node_getter=_node_getter(commit2),
-                    comments=inline_comments
-                ).render_patchset(_parsed, commit1.raw_id, commit2.raw_id)
+                    comments=inline_comments)
+                diffset = diffset.render_patchset(
+                    _parsed, commit1.raw_id, commit2.raw_id)
+
                 c.changes[commit.raw_id] = diffset
             else:
                 # downloads/raw we only need RAW diff nothing else
diff --git a/rhodecode/controllers/compare.py b/rhodecode/controllers/compare.py
--- a/rhodecode/controllers/compare.py
+++ b/rhodecode/controllers/compare.py
@@ -271,11 +271,13 @@ class CompareController(BaseRepoControll
                     return None
             return get_node
 
-        c.diffset = codeblocks.DiffSet(
+        diffset = codeblocks.DiffSet(
             repo_name=source_repo.repo_name,
             source_node_getter=_node_getter(source_commit),
             target_node_getter=_node_getter(target_commit),
-        ).render_patchset(_parsed, source_ref, target_ref)
+        )
+        c.diffset = diffset.render_patchset(
+            _parsed, source_ref, target_ref)
 
         c.preview_mode = merge
         c.source_commit = source_commit
diff --git a/rhodecode/lib/codeblocks.py b/rhodecode/lib/codeblocks.py
--- a/rhodecode/lib/codeblocks.py
+++ b/rhodecode/lib/codeblocks.py
@@ -471,31 +471,29 @@ class DiffSet(object):
         source_file_type = source_lexer.name
         target_file_type = target_lexer.name
 
-        op_hunks = patch['chunks'][0]
-        hunks = patch['chunks'][1:]
-
         filediff = AttributeDict({
             'source_file_path': source_file_path,
             'target_file_path': target_file_path,
             'source_filenode': source_filenode,
             'target_filenode': target_filenode,
-            'hunks': [],
             'source_file_type': target_file_type,
             'target_file_type': source_file_type,
-            'patch': patch,
+            'patch': {'filename': patch['filename'], 'stats': patch['stats']},
+            'operation': patch['operation'],
             'source_mode': patch['stats']['old_mode'],
             'target_mode': patch['stats']['new_mode'],
             'limited_diff': isinstance(patch, LimitedDiffContainer),
+            'hunks': [],
             'diffset': self,
         })
 
-        for hunk in hunks:
+        for hunk in patch['chunks'][1:]:
             hunkbit = self.parse_hunk(hunk, source_file, target_file)
-            hunkbit.filediff = filediff
+            hunkbit.source_file_path = source_file_path
+            hunkbit.target_file_path = target_file_path
             filediff.hunks.append(hunkbit)
 
         left_comments = {}
-
         if source_file_path in self.comments_store:
             for lineno, comments in self.comments_store[source_file_path].items():
                 left_comments[lineno] = comments
@@ -503,8 +501,8 @@ class DiffSet(object):
         if target_file_path in self.comments_store:
             for lineno, comments in self.comments_store[target_file_path].items():
                 left_comments[lineno] = comments
+        filediff.left_comments = left_comments
 
-        filediff.left_comments = left_comments
         return filediff
 
     def parse_hunk(self, hunk, source_file, target_file):
@@ -519,6 +517,7 @@ class DiffSet(object):
         before, after = [], []
 
         for line in hunk['lines']:
+
             if line['action'] == 'unmod':
                 result.lines.extend(
                     self.parse_lines(before, after, source_file, target_file))
@@ -567,7 +566,8 @@ class DiffSet(object):
                     before_tokens = [('nonl', before['line'])]
                 else:
                     before_tokens = self.get_line_tokens(
-                        line_text=before['line'], line_number=before['old_lineno'],
+                        line_text=before['line'],
+                        line_number=before['old_lineno'],
                         file=source_file)
                 original.lineno = before['old_lineno']
                 original.content = before['line']
diff --git a/rhodecode/templates/codeblocks/diffs.mako b/rhodecode/templates/codeblocks/diffs.mako
--- a/rhodecode/templates/codeblocks/diffs.mako
+++ b/rhodecode/templates/codeblocks/diffs.mako
@@ -147,14 +147,14 @@ collapse_all = len(diffset.files) > coll
     %for i, filediff in enumerate(diffset.files):
 
         <%
-        lines_changed = filediff['patch']['stats']['added'] + filediff['patch']['stats']['deleted']
+        lines_changed = filediff.patch['stats']['added'] + filediff.patch['stats']['deleted']
         over_lines_changed_limit = lines_changed > lines_changed_limit
         %>
         <input ${collapse_all and 'checked' or ''} class="filediff-collapse-state" id="filediff-collapse-${id(filediff)}" type="checkbox">
         <div
             class="filediff"
-            data-f-path="${filediff['patch']['filename']}"
-            id="a_${h.FID('', filediff['patch']['filename'])}">
+            data-f-path="${filediff.patch['filename']}"
+            id="a_${h.FID('', filediff.patch['filename'])}">
             <label for="filediff-collapse-${id(filediff)}" class="filediff-heading">
                 <div class="filediff-collapse-indicator"></div>
                 ${diff_ops(filediff)}
@@ -162,7 +162,7 @@ collapse_all = len(diffset.files) > coll
             ${diff_menu(filediff, use_comments=use_comments)}
             <table class="cb cb-diff-${c.diffmode} code-highlight ${over_lines_changed_limit and 'cb-collapsed' or ''}">
         %if not filediff.hunks:
-            %for op_id, op_text in filediff['patch']['stats']['ops'].items():
+            %for op_id, op_text in filediff.patch['stats']['ops'].items():
                 <tr>
                     <td class="cb-text cb-${op_class(op_id)}" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}>
                         %if op_id == DEL_FILENODE:
@@ -176,7 +176,7 @@ collapse_all = len(diffset.files) > coll
                 </tr>
             %endfor
         %endif
-        %if filediff.patch['is_limited_diff']:
+        %if filediff.limited_diff:
                 <tr class="cb-warning cb-collapser">
                     <td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}>
                         ${_('The requested commit is too big and content was truncated.')} <a href="${link_for(fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a>
@@ -322,7 +322,6 @@ collapse_all = len(diffset.files) > coll
 
 <%def name="diff_ops(filediff)">
 <%
-stats = filediff['patch']['stats']
 from rhodecode.lib.diffs import NEW_FILENODE, DEL_FILENODE, \
     MOD_FILENODE, RENAMED_FILENODE, CHMOD_FILENODE, BIN_FILENODE, COPIED_FILENODE
 %>
@@ -330,9 +329,9 @@ from rhodecode.lib.diffs import NEW_FILE
         %if filediff.source_file_path and filediff.target_file_path:
             %if filediff.source_file_path != filediff.target_file_path:
                  ## file was renamed, or copied
-                %if RENAMED_FILENODE in stats['ops']:
+                %if RENAMED_FILENODE in filediff.patch['stats']['ops']:
                     <strong>${filediff.target_file_path}</strong> ⬅ <del>${filediff.source_file_path}</del>
-                %elif COPIED_FILENODE in stats['ops']:
+                %elif COPIED_FILENODE in filediff.patch['stats']['ops']:
                     <strong>${filediff.target_file_path}</strong> ⬅ ${filediff.source_file_path}
                 %endif
             %else:
@@ -350,19 +349,19 @@ from rhodecode.lib.diffs import NEW_FILE
         %endif
     </span>
     <span class="pill-group" style="float: left">
-        %if filediff.patch['is_limited_diff']:
+        %if filediff.limited_diff:
         <span class="pill tooltip" op="limited" title="The stats for this diff are not complete">limited diff</span>
         %endif
 
-        %if RENAMED_FILENODE in stats['ops']:
+        %if RENAMED_FILENODE in filediff.patch['stats']['ops']:
         <span class="pill" op="renamed">renamed</span>
         %endif
 
-        %if COPIED_FILENODE in stats['ops']:
+        %if COPIED_FILENODE in filediff.patch['stats']['ops']:
         <span class="pill" op="copied">copied</span>
         %endif
 
-        %if NEW_FILENODE in stats['ops']:
+        %if NEW_FILENODE in filediff.patch['stats']['ops']:
         <span class="pill" op="created">created</span>
             %if filediff['target_mode'].startswith('120'):
         <span class="pill" op="symlink">symlink</span>
@@ -371,11 +370,11 @@ from rhodecode.lib.diffs import NEW_FILE
             %endif
         %endif
 
-        %if DEL_FILENODE in stats['ops']:
+        %if DEL_FILENODE in filediff.patch['stats']['ops']:
         <span class="pill" op="removed">removed</span>
         %endif
 
-        %if CHMOD_FILENODE in stats['ops']:
+        %if CHMOD_FILENODE in filediff.patch['stats']['ops']:
         <span class="pill" op="mode">
             ${nice_mode(filediff['source_mode'])} ➡ ${nice_mode(filediff['target_mode'])}
         </span>
@@ -385,17 +384,17 @@ from rhodecode.lib.diffs import NEW_FILE
     <a class="pill filediff-anchor" href="#a_${h.FID('', filediff.patch['filename'])}">¶</a>
 
     <span class="pill-group" style="float: right">
-        %if BIN_FILENODE in stats['ops']:
+        %if BIN_FILENODE in filediff.patch['stats']['ops']:
         <span class="pill" op="binary">binary</span>
-            %if MOD_FILENODE in stats['ops']:
+            %if MOD_FILENODE in filediff.patch['stats']['ops']:
             <span class="pill" op="modified">modified</span>
             %endif
         %endif
-        %if stats['added']:
-        <span class="pill" op="added">+${stats['added']}</span>
+        %if filediff.patch['stats']['added']:
+        <span class="pill" op="added">+${filediff.patch['stats']['added']}</span>
         %endif
-        %if stats['deleted']:
-        <span class="pill" op="deleted">-${stats['deleted']}</span>
+        %if filediff.patch['stats']['deleted']:
+        <span class="pill" op="deleted">-${filediff.patch['stats']['deleted']}</span>
         %endif
     </span>
 
@@ -408,7 +407,7 @@ from rhodecode.lib.diffs import NEW_FILE
 <%def name="diff_menu(filediff, use_comments=False)">
     <div class="filediff-menu">
 %if filediff.diffset.source_ref:
-    %if filediff.patch['operation'] in ['D', 'M']:
+    %if filediff.operation in ['D', 'M']:
         <a
             class="tooltip"
             href="${h.url('files_home',repo_name=filediff.diffset.repo_name,f_path=filediff.source_file_path,revision=filediff.diffset.source_ref)}"
@@ -424,7 +423,7 @@ from rhodecode.lib.diffs import NEW_FILE
             ${_('Show file before')}
         </span> |
     %endif
-    %if filediff.patch['operation'] in ['A', 'M']:
+    %if filediff.operation in ['A', 'M']:
         <a
             class="tooltip"
             href="${h.url('files_home',repo_name=filediff.diffset.source_repo_name,f_path=filediff.target_file_path,revision=filediff.diffset.target_ref)}"
@@ -460,10 +459,10 @@ from rhodecode.lib.diffs import NEW_FILE
 
         ## TODO: dan: refactor ignorews_url and context_url into the diff renderer same as diffmode=unified/sideside. Also use ajax to load more context (by clicking hunks)
         %if hasattr(c, 'ignorews_url'):
-        ${c.ignorews_url(request.GET, h.FID('', filediff['patch']['filename']))}
+        ${c.ignorews_url(request.GET, h.FID('', filediff.patch['filename']))}
         %endif
         %if hasattr(c, 'context_url'):
-        ${c.context_url(request.GET, h.FID('', filediff['patch']['filename']))}
+        ${c.context_url(request.GET, h.FID('', filediff.patch['filename']))}
         %endif
 
         %if use_comments:
@@ -503,9 +502,9 @@ from rhodecode.lib.diffs import NEW_FILE
     <%
     old_line_anchor, new_line_anchor = None, None
     if line.original.lineno:
-        old_line_anchor = diff_line_anchor(hunk.filediff.source_file_path, line.original.lineno, 'o')
+        old_line_anchor = diff_line_anchor(hunk.source_file_path, line.original.lineno, 'o')
     if line.modified.lineno:
-        new_line_anchor = diff_line_anchor(hunk.filediff.target_file_path, line.modified.lineno, 'n')
+        new_line_anchor = diff_line_anchor(hunk.target_file_path, line.modified.lineno, 'n')
     %>
 
     <tr class="cb-line">
@@ -579,9 +578,9 @@ from rhodecode.lib.diffs import NEW_FILE
     <%
     old_line_anchor, new_line_anchor = None, None
     if old_line_no:
-        old_line_anchor = diff_line_anchor(hunk.filediff.source_file_path, old_line_no, 'o')
+        old_line_anchor = diff_line_anchor(hunk.source_file_path, old_line_no, 'o')
     if new_line_no:
-        new_line_anchor = diff_line_anchor(hunk.filediff.target_file_path, new_line_no, 'n')
+        new_line_anchor = diff_line_anchor(hunk.target_file_path, new_line_no, 'n')
     %>
     <tr class="cb-line">
         <td class="cb-data ${action_class(action)}">