diff --git a/app/contexts/commit_load.rb b/app/contexts/commit_load_context.rb
similarity index 89%
rename from app/contexts/commit_load.rb
rename to app/contexts/commit_load_context.rb
index 81fb4925cc8e969379e535b711fece8b1c96a4e4..b3548ed858e672c24cac30212dd6d6ef0a9607e7 100644
--- a/app/contexts/commit_load.rb
+++ b/app/contexts/commit_load_context.rb
@@ -1,17 +1,17 @@
-class CommitLoad < BaseContext
+class CommitLoadContext < BaseContext
   def execute
-    result = { 
+    result = {
       commit: nil,
       suppress_diff: false,
       line_notes: [],
       notes_count: 0,
-      note: nil, 
+      note: nil,
       status: :ok
     }
 
     commit = project.commit(params[:id])
 
-    if commit 
+    if commit
       commit = CommitDecorator.decorate(commit)
       line_notes = project.commit_line_notes(commit)
 
diff --git a/app/contexts/issues_list_context.rb b/app/contexts/issues_list_context.rb
new file mode 100644
index 0000000000000000000000000000000000000000..9bbdfe1db39ecfde3afdd18c59e6fd9f8377b313
--- /dev/null
+++ b/app/contexts/issues_list_context.rb
@@ -0,0 +1,29 @@
+class IssuesListContext < BaseContext
+  include IssuesHelper
+
+  attr_accessor :issues
+
+  def execute
+    @issues = case params[:f]
+              when issues_filter[:all] then @project.issues
+              when issues_filter[:closed] then @project.issues.closed
+              when issues_filter[:to_me] then @project.issues.opened.assigned(current_user)
+              else @project.issues.opened
+              end
+
+    @issues = @issues.tagged_with(params[:label_name]) if params[:label_name].present?
+    @issues = @issues.includes(:author, :project).order("updated_at")
+
+    # Filter by specific assignee_id (or lack thereof)?
+    if params[:assignee_id].present?
+      @issues = @issues.where(assignee_id: (params[:assignee_id] == '0' ? nil : params[:assignee_id]))
+    end
+
+    # Filter by specific milestone_id (or lack thereof)?
+    if params[:milestone_id].present?
+      @issues = @issues.where(milestone_id: (params[:milestone_id] == '0' ? nil : params[:milestone_id]))
+    end
+
+    @issues
+  end
+end
diff --git a/app/contexts/merge_requests_load.rb b/app/contexts/merge_requests_load_context.rb
similarity index 91%
rename from app/contexts/merge_requests_load.rb
rename to app/contexts/merge_requests_load_context.rb
index e2f68e3805b02de4a5a869ba7c3bc29f9b05a162..e7dbdd285eeb62061242972a30a48cfe08c02033 100644
--- a/app/contexts/merge_requests_load.rb
+++ b/app/contexts/merge_requests_load_context.rb
@@ -1,4 +1,4 @@
-class MergeRequestsLoad < BaseContext
+class MergeRequestsLoadContext < BaseContext
   def execute
     type = params[:f]
 
diff --git a/app/contexts/search_context.rb b/app/contexts/search_context.rb
new file mode 100644
index 0000000000000000000000000000000000000000..6e5e8c5e9b5ee7e1a9b28ed9dac5cec8fe7113df
--- /dev/null
+++ b/app/contexts/search_context.rb
@@ -0,0 +1,27 @@
+class SearchContext
+  attr_accessor :project_ids, :params
+
+  def initialize(project_ids, params)
+    @project_ids, @params = project_ids, params.dup
+  end
+
+  def execute
+    query = params[:search]
+
+    return result unless query.present?
+
+    result[:projects] = Project.where(id: project_ids).search(query).limit(10)
+    result[:merge_requests] = MergeRequest.where(project_id: project_ids).search(query).limit(10)
+    result[:issues] = Issue.where(project_id: project_ids).search(query).limit(10)
+    result
+  end
+
+  def result
+    @result ||= {
+      projects: [],
+      merge_requests: [],
+      issues: []
+    }
+  end
+end
+
diff --git a/app/controllers/commit_controller.rb b/app/controllers/commit_controller.rb
index 25a1f0fe7080d4ce2f408cc20929861a09c0ebcd..97998352255ff6e1aa47b64cd2e1031bcf9753e1 100644
--- a/app/controllers/commit_controller.rb
+++ b/app/controllers/commit_controller.rb
@@ -8,7 +8,7 @@ class CommitController < ProjectResourceController
   before_filter :require_non_empty_project
 
   def show
-    result = CommitLoad.new(project, current_user, params).execute
+    result = CommitLoadContext.new(project, current_user, params).execute
 
     @commit = result[:commit]
     git_not_found! unless @commit
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb
index ee82d0f44dbc3f888ac997aa06efd24df772b93e..0ad73f32b5a544ac1a89009cebe2dc63a30c0f88 100644
--- a/app/controllers/dashboard_controller.rb
+++ b/app/controllers/dashboard_controller.rb
@@ -6,7 +6,7 @@ class DashboardController < ApplicationController
     @projects = current_user.projects_with_events
     @projects = @projects.page(params[:page]).per(20)
 
-    @events = Event.recent_for_user(current_user).limit(20).offset(params[:offset] || 0)
+    @events = Event.in_projects(current_user.project_ids).limit(20).offset(params[:offset] || 0)
     @last_push = current_user.recent_push
 
     respond_to do |format|
@@ -19,14 +19,14 @@ class DashboardController < ApplicationController
   # Get authored or assigned open merge requests
   def merge_requests
     @projects = current_user.projects.all
-    @merge_requests = current_user.cared_merge_requests.order("created_at DESC").page(params[:page]).per(20)
+    @merge_requests = current_user.cared_merge_requests.recent.page(params[:page]).per(20)
   end
 
   # Get only assigned issues
   def issues
     @projects = current_user.projects.all
     @user   = current_user
-    @issues = current_user.assigned_issues.opened.order("created_at DESC").page(params[:page]).per(20)
+    @issues = current_user.assigned_issues.opened.recent.page(params[:page]).per(20)
     @issues = @issues.includes(:author, :project)
 
     respond_to do |format|
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index 5576bc03fc73212b713830858920c9c0177ce759..761238a98b5f602d74ae6adfab4f706b2a28ab3f 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -6,10 +6,7 @@ class GroupsController < ApplicationController
   before_filter :projects
 
   def show
-    @events = Event.where(project_id: project_ids).
-      order('id DESC').
-      limit(20).offset(params[:offset] || 0)
-
+    @events = Event.in_projects(project_ids).limit(20).offset(params[:offset] || 0)
     @last_push = current_user.recent_push
 
     respond_to do |format|
@@ -22,14 +19,14 @@ class GroupsController < ApplicationController
   # Get authored or assigned open merge requests
   def merge_requests
     @merge_requests = current_user.cared_merge_requests
-    @merge_requests = @merge_requests.of_group(@group).order("created_at DESC").page(params[:page]).per(20)
+    @merge_requests = @merge_requests.of_group(@group).recent.page(params[:page]).per(20)
   end
 
   # Get only assigned issues
   def issues
     @user   = current_user
     @issues = current_user.assigned_issues.opened
-    @issues = @issues.of_group(@group).order("created_at DESC").page(params[:page]).per(20)
+    @issues = @issues.of_group(@group).recent.page(params[:page]).per(20)
     @issues = @issues.includes(:author, :project)
 
     respond_to do |format|
@@ -39,16 +36,11 @@ class GroupsController < ApplicationController
   end
 
   def search
-    query = params[:search]
-
-    @merge_requests = []
-    @issues = []
+    result = SearchContext.new(project_ids, params).execute
 
-    if query.present?
-      @projects = @projects.search(query).limit(10)
-      @merge_requests = MergeRequest.where(project_id: project_ids).search(query).limit(10)
-      @issues = Issue.where(project_id: project_ids).search(query).limit(10)
-    end
+    @projects       = result[:projects]
+    @merge_requests = result[:merge_requests]
+    @issues         = result[:issues]
   end
 
   def people
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 82ae5b37deb2dd2a8fcbd64994f9812a0566f213..0f28fc3a111e9c09d7b08ac3806de9a68fc776be 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -1,7 +1,6 @@
 class IssuesController < ProjectResourceController
   before_filter :module_enabled
   before_filter :issue, only: [:edit, :update, :destroy, :show]
-  helper_method :issues_filter
 
   # Allow read any issue
   before_filter :authorize_read_issue!
@@ -19,7 +18,6 @@ class IssuesController < ProjectResourceController
 
   def index
     @issues = issues_filtered
-
     @issues = @issues.page(params[:page]).per(20)
 
     respond_to do |format|
@@ -54,7 +52,7 @@ class IssuesController < ProjectResourceController
 
     respond_to do |format|
       format.html do
-        if @issue.valid? 
+        if @issue.valid?
           redirect_to project_issue_path(@project, @issue)
         else
           render :new
@@ -69,7 +67,7 @@ class IssuesController < ProjectResourceController
 
     respond_to do |format|
       format.js
-      format.html do 
+      format.html do
         if @issue.valid?
           redirect_to [@project, @issue]
         else
@@ -134,35 +132,6 @@ class IssuesController < ProjectResourceController
   end
 
   def issues_filtered
-    @issues = case params[:f]
-              when issues_filter[:all] then @project.issues
-              when issues_filter[:closed] then @project.issues.closed
-              when issues_filter[:to_me] then @project.issues.opened.assigned(current_user)
-              else @project.issues.opened
-              end
-
-    @issues = @issues.tagged_with(params[:label_name]) if params[:label_name].present?
-    @issues = @issues.includes(:author, :project).order("updated_at")
-
-    # Filter by specific assignee_id (or lack thereof)?
-    if params[:assignee_id].present?
-      @issues = @issues.where(assignee_id: (params[:assignee_id] == '0' ? nil : params[:assignee_id]))
-    end
-
-    # Filter by specific milestone_id (or lack thereof)?
-    if params[:milestone_id].present?
-      @issues = @issues.where(milestone_id: (params[:milestone_id] == '0' ? nil : params[:milestone_id]))
-    end
-
-    @issues
-  end
-
-  def issues_filter
-    {
-      all: "all",
-      closed: "closed",
-      to_me: "assigned-to-me",
-      open: "open" 
-    }
+    @issues = IssuesListContext.new(project, current_user, params).execute
   end
 end
diff --git a/app/controllers/merge_requests_controller.rb b/app/controllers/merge_requests_controller.rb
index f8d842636880e1e3f2ceefcc449b7f8936555d82..8e180c9baae7cd78129755f84ceced37d4bc54cc 100644
--- a/app/controllers/merge_requests_controller.rb
+++ b/app/controllers/merge_requests_controller.rb
@@ -18,7 +18,7 @@ class MergeRequestsController < ProjectResourceController
 
 
   def index
-    @merge_requests = MergeRequestsLoad.new(project, current_user, params).execute
+    @merge_requests = MergeRequestsLoadContext.new(project, current_user, params).execute
   end
 
   def show
@@ -55,7 +55,7 @@ class MergeRequestsController < ProjectResourceController
       @merge_request.reload_code
       redirect_to [@project, @merge_request], notice: 'Merge request was successfully created.'
     else
-      render action: "new" 
+      render action: "new"
     end
   end
 
@@ -70,7 +70,7 @@ class MergeRequestsController < ProjectResourceController
   end
 
   def automerge_check
-    if @merge_request.unchecked? 
+    if @merge_request.unchecked?
       @merge_request.check_if_can_be_merged
     end
     render json: {state: @merge_request.human_state}
@@ -125,7 +125,7 @@ class MergeRequestsController < ProjectResourceController
 
   def validates_merge_request
     # Show git not found page if target branch doesnt exist
-    return git_not_found! unless @project.repo.heads.map(&:name).include?(@merge_request.target_branch) 
+    return git_not_found! unless @project.repo.heads.map(&:name).include?(@merge_request.target_branch)
 
     # Show git not found page if source branch doesnt exist
     # and there is no saved commits between source & target branch
@@ -136,7 +136,7 @@ class MergeRequestsController < ProjectResourceController
     # Build a note object for comment form
     @note = @project.notes.new(noteable: @merge_request)
 
-    # Get commits from repository 
+    # Get commits from repository
     # or from cache if already merged
     @commits = @merge_request.commits
     @commits = CommitDecorator.decorate(@commits)
diff --git a/app/controllers/milestones_controller.rb b/app/controllers/milestones_controller.rb
index 68479a26923854686074d6a0bf229154ec3845dd..f8fe987c4379ad93f7982c7387e4034372b1dc96 100644
--- a/app/controllers/milestones_controller.rb
+++ b/app/controllers/milestones_controller.rb
@@ -54,7 +54,7 @@ class MilestonesController < ProjectResourceController
 
     respond_to do |format|
       format.js
-      format.html do 
+      format.html do
         if @milestone.valid?
           redirect_to [@project, @milestone]
         else
diff --git a/app/controllers/refs_controller.rb b/app/controllers/refs_controller.rb
index d3fc816bfd9a396727963c5fcf73aa03ca89f737..6a1a3606360849c3a06f0e550b1a4d0a2152a618 100644
--- a/app/controllers/refs_controller.rb
+++ b/app/controllers/refs_controller.rb
@@ -9,9 +9,9 @@ class RefsController < ProjectResourceController
   before_filter :ref
   before_filter :define_tree_vars, only: [:blob, :logs_tree]
 
-  def switch 
-    respond_to do |format| 
-      format.html do 
+  def switch
+    respond_to do |format|
+      format.html do
         new_path = if params[:destination] == "tree"
                      project_tree_path(@project, @ref)
                    else
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index 71e2d92b2b2c9eb6fc75d6dbb22cad6154d37a5e..1dc8507e019073dec2b0081d8ba7d8c90d3286a0 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -1,15 +1,9 @@
 class SearchController < ApplicationController
   def show
-    query = params[:search]
+    result = SearchContext.new(current_user.project_ids, params).execute
 
-    @projects = []
-    @merge_requests = []
-    @issues = []
-
-    if query.present?
-      @projects = current_user.projects.search(query).limit(10)
-      @merge_requests = MergeRequest.where(project_id: current_user.project_ids).search(query).limit(10)
-      @issues = Issue.where(project_id: current_user.project_ids).search(query).limit(10)
-    end
+    @projects       = result[:projects]
+    @merge_requests = result[:merge_requests]
+    @issues         = result[:issues]
   end
 end
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 9b537187e950d7b30d7b68029015209b00ce0f4e..99ea9ef2975dc8e5af615a0d155d104c02ede112 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -43,4 +43,13 @@ module IssuesHelper
     # Milestone uses :title, Issue uses :name
     OpenStruct.new(id: 0, title: 'Unspecified', name: 'Unassigned')
   end
+
+  def issues_filter
+    {
+      all: "all",
+      closed: "closed",
+      to_me: "assigned-to-me",
+      open: "open"
+    }
+  end
 end
diff --git a/app/models/event.rb b/app/models/event.rb
index 647abdb9b57348218a24e69dee32e1dba0a22ce9..0ea3224a3b7b646a9540ac849eface8bca00a166 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -30,6 +30,7 @@ class Event < ActiveRecord::Base
   # Scopes
   scope :recent, order("created_at DESC")
   scope :code_push, where(action: Pushed)
+  scope :in_projects, ->(project_ids) { where(project_id: project_ids).recent }
 
   class << self
     def determine_action(record)
@@ -39,10 +40,6 @@ class Event < ActiveRecord::Base
         Event::Commented
       end
     end
-
-    def recent_for_user user
-      where(project_id: user.projects.map(&:id)).recent
-    end
   end
 
   # Next events currently enabled for system
diff --git a/app/roles/issue_commonality.rb b/app/roles/issue_commonality.rb
index 4aee916c03c7591879161c1f1a56752b999efb89..3d9074867b70488f50959857786783d97814ef20 100644
--- a/app/roles/issue_commonality.rb
+++ b/app/roles/issue_commonality.rb
@@ -1,5 +1,4 @@
-# Contains common functionality
-# shared between Issues and MergeRequests
+# Contains common functionality shared between Issues and MergeRequests
 module IssueCommonality
   extend ActiveSupport::Concern
 
@@ -18,6 +17,7 @@ module IssueCommonality
     scope :closed, where(closed: true)
     scope :of_group, ->(group) { where(project_id: group.project_ids) }
     scope :assigned, ->(u) { where(assignee_id: u.id)}
+    scope :recent, order("created_at DESC")
 
     delegate :name,
              :email,