diff --git a/~dev_rating/application/classes/Controller/Student/Index.php b/~dev_rating/application/classes/Controller/Student/Index.php
index fc68cf6cd776cd3ba35138e9e72de8eca8294af9..30843a96ba0fd8a17ef200f19ab999960b2cd441 100644
--- a/~dev_rating/application/classes/Controller/Student/Index.php
+++ b/~dev_rating/application/classes/Controller/Student/Index.php
@@ -1,5 +1,5 @@
 <?php defined('SYSPATH') or die('No direct script access.');
- 
+
 class Controller_Student_Index extends Controller_Environment_Student
 {
     public function action_index() {
@@ -12,10 +12,15 @@ class Controller_Student_Index extends Controller_Environment_Student
                 $marks[$dis->ID] = Model_Subject::getECTSMark($dis->Rate, $dis->MaxCurrentRate, $exam = NULL);
         }
 
+        $teachers = $student->getTeachers();
+        foreach ($teachers as $disID => &$list) {
+            $list = Controller_Teacher_Index::getShortListOfTeachers($list);
+        }
+
         $this->twig->set([
             'Marks'        => $marks,
             'Disciplines'  => $disciplines,
-            'Teachers'     => $student->getTeachers(),
+            'Teachers'     => $teachers,
             'SemesterList' => Model_Semesters::loadAll(),
         ])->set_filename(static::STUDENT . 'index');
     }
@@ -24,4 +29,4 @@ class Controller_Student_Index extends Controller_Environment_Student
         $this->twig->set_filename('settings');
     }
 }
-            
+
diff --git a/~dev_rating/application/classes/Controller/Teacher/Index.php b/~dev_rating/application/classes/Controller/Teacher/Index.php
index 5d5465f83fb67849ffd5fa43f67720fcc98414a9..d6e7c9d7a725789057c50b986dee3762f31734ea 100644
--- a/~dev_rating/application/classes/Controller/Teacher/Index.php
+++ b/~dev_rating/application/classes/Controller/Teacher/Index.php
@@ -29,8 +29,10 @@ class Controller_Teacher_Index extends Controller_Environment_Teacher
             $scientific = $dis->Subtype == Model_CourseWork::SCIENTIFIC;
 
             // todo: Pavel will write an optimized query
-            if (!$scientific && !$teachers[$dis->ID])
-                $teachers[$dis->ID] = $dis->getTeachers();
+            if (!$scientific && !$teachers[$dis->ID]) {
+                $list = $dis->getTeachers()->groupByUniqueKey('ID');
+                $teachers[$dis->ID] = $this->getShortListOfTeachers($list, $dis->AuthorID, $this->user->TeacherID);
+            }
             if (isset($dis->GroupNum) && $dis->GroupNum)
                 $groups[$dis->ID][] = $dis->GroupNum . ' РіСЂ.';
         }
@@ -42,8 +44,20 @@ class Controller_Teacher_Index extends Controller_Environment_Teacher
             'SemesterList' => Model_Semesters::loadAll(),
         ])->set_filename('teacher/index');
     }
-    
+
+    public static function getShortListOfTeachers(&$teachers, $authorID = null, $vipID = null) {
+        $short = [];
+
+        // place vip & author at the beginning
+        foreach ($teachers as $id => &$teacher) {
+            if ($id == $authorID || $id == $vipID)
+                $short += [$id => $teacher];
+        }
+
+        return $short + Arr::shuffle_assoc($teachers);
+    }
+
     public function action_settings() {
         $this->twig->set_filename('settings');
     }
-}
\ No newline at end of file
+}
diff --git a/~dev_rating/application/views/student/index.twig b/~dev_rating/application/views/student/index.twig
index 5161d05f89808fb4db67715a44a4705575a72630..00c00a732779225cf42da034225143b994cc6d93 100644
--- a/~dev_rating/application/views/student/index.twig
+++ b/~dev_rating/application/views/student/index.twig
@@ -26,11 +26,13 @@
         {% elseif Discipline.Subtype == 'scientific_coursework' %}
             Науч. рук.
         {% else %}
-            {% for teacher in Teachers[Discipline.ID] %}
-                {{ Text.abbreviateName(teacher) }}<br>
+            {% for teacher in Teachers[Discipline.ID] |slice(0, 4) |sortbyfield('LastName') %}
+                <div>{{ Text.abbreviateName(teacher) }}</div>
             {% else %}
                 —
             {% endfor %}
+
+
         {% endif %}
     </td>
 
diff --git a/~dev_rating/application/views/teacher/index.twig b/~dev_rating/application/views/teacher/index.twig
index d1de4d91d9a909ebf8178b442a6563cd0da72d7b..5483d30e62d1e56016e870155ce98ef8a898a305 100644
--- a/~dev_rating/application/views/teacher/index.twig
+++ b/~dev_rating/application/views/teacher/index.twig
@@ -21,7 +21,7 @@
             {% if Discipline.Subtype == 'scientific_coursework' %}
                 Сотрудники кафедры
             {% else %}
-                {% for teacher in Teachers[Discipline.ID] | slice(0, 7) %}
+                {% for teacher in Teachers[Discipline.ID] |slice(0, 4) |sortbyfield('LastName') %}
                     <div>{{ Text.abbreviateName(teacher) }}</div>
                 {% else %}
                     —
@@ -140,4 +140,4 @@
             <h2 style="text-align: center;">В настоящий момент Вы не подписаны ни на одну из существующих дисциплин.</h2>
         {% endfor %}
     </div>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/~dev_rating/modules/database/classes/Kohana/Database/Result.php b/~dev_rating/modules/database/classes/Kohana/Database/Result.php
index f415891bd2ddbb04c271fa1dc5d42a0587bafe94..b371c36fbd03a8ea738e57fba2cc05d668a47eb5 100644
--- a/~dev_rating/modules/database/classes/Kohana/Database/Result.php
+++ b/~dev_rating/modules/database/classes/Kohana/Database/Result.php
@@ -171,6 +171,18 @@ abstract class Kohana_Database_Result implements Countable, Iterator, SeekableIt
 		return $results;
 	}
 
+    public function groupByUniqueKey($key) {
+        $results = [];
+
+        foreach ($this as $row) {
+            $results[$row[$key]] = $row;
+        }
+
+        $this->rewind();
+
+        return $results;
+    }
+
 	/**
 	 * Return the named column from the current row.
 	 *
diff --git a/~dev_rating/modules/kotwig/vendor/twig/lib/Twig/Environment.php b/~dev_rating/modules/kotwig/vendor/twig/lib/Twig/Environment.php
index d3ba9be91ff3f98c2da00003e35c50d97fa1f6f0..2de2cd1717a94ce9e6e1458bcd8b54b601cc65bd 100644
--- a/~dev_rating/modules/kotwig/vendor/twig/lib/Twig/Environment.php
+++ b/~dev_rating/modules/kotwig/vendor/twig/lib/Twig/Environment.php
@@ -111,6 +111,7 @@ class Twig_Environment
         $this->addExtension(new Twig_Extension_Core());
         $this->addExtension(new Twig_Extension_Escaper($options['autoescape']));
         $this->addExtension(new Twig_Extension_Optimizer($options['optimizations']));
+        $this->addExtension(new Twig_Extension_SortByField());
         $this->extensionInitialized = false;
         $this->staging = new Twig_Extension_Staging();
     }
diff --git a/~dev_rating/modules/kotwig/vendor/twig/lib/Twig/Extension/SortByField.php b/~dev_rating/modules/kotwig/vendor/twig/lib/Twig/Extension/SortByField.php
new file mode 100644
index 0000000000000000000000000000000000000000..ea916215d9b2294fbb8bc31525470e0313edcab3
--- /dev/null
+++ b/~dev_rating/modules/kotwig/vendor/twig/lib/Twig/Extension/SortByField.php
@@ -0,0 +1,72 @@
+<?php
+
+/**
+ * User: Victor Häggqvist
+ * Date: 3/4/15
+ * Time: 2:07 AM
+ *
+ * The base of the filter is borrowed from https://github.com/dannynimmo/craftcms-sortbyfield
+ *
+ * I have extended it to also sort array structures
+ */
+class Twig_Extension_SortByField extends \Twig_Extension {
+    public function getName() {
+        return 'sortbyfield';
+    }
+    public function getFilters() {
+        return array(
+            new \Twig_SimpleFilter('sortbyfield', array($this, 'sortByFieldFilter'))
+        );
+    }
+    /**
+     * The "sortByField" filter sorts an array of entries (objects or arrays) by the specified field's value
+     *
+     * Usage: {% for entry in master.entries|sortbyfield('ordering', 'desc') %}
+     */
+    public function sortByFieldFilter($content, $sort_by = null, $direction = 'asc') {
+        if (!is_array($content)) {
+            throw new \InvalidArgumentException('Variable passed to the sortByField filter is not an array');
+        } elseif ($sort_by === null) {
+            throw new Exception('No sort by parameter passed to the sortByField filter');
+        } elseif (!self::isSortable($content[0], $sort_by)) {
+            throw new Exception('Entries passed to the sortByField filter do not have the field "' . $sort_by . '"');
+        } else {
+            // Unfortunately have to suppress warnings here due to __get function
+            // causing usort to think that the array has been modified:
+            // usort(): Array was modified by the user comparison function
+            @usort($content, function ($a, $b) use($sort_by, $direction) {
+                $flip = ($direction === 'desc') ? -1 : 1;
+                if (is_array($a))
+                    $a_sort_value = $a[$sort_by];
+                else
+                    $a_sort_value = $a->$sort_by;
+                if (is_array($b))
+                    $b_sort_value = $b[$sort_by];
+                else
+                    $b_sort_value = $b->$sort_by;
+                if($a_sort_value == $b_sort_value) {
+                    return 0;
+                } else if($a_sort_value > $b_sort_value) {
+                    return (1 * $flip);
+                } else {
+                    return (-1 * $flip);
+                }
+            });
+        }
+        return $content;
+    }
+    /**
+     * Validate the passed $item to check if it can be sorted
+     * @param $item mixed Collection item to be sorted
+     * @param $field string
+     * @return bool If collection item can be sorted
+     */
+    private static function isSortable($item, $field) {
+        if (is_array($item))
+            return array_key_exists($field, $item);
+        elseif (is_object($item))
+            return property_exists($item, $field);
+        else
+            return false;
+    }
+}
diff --git a/~dev_rating/system/classes/Kohana/Arr.php b/~dev_rating/system/classes/Kohana/Arr.php
index 4876fe6e6e3c0b1708918c1a4bba9b276cc1d4ed..27b110246a088ff1885773b1bfa3cba9be578544 100644
--- a/~dev_rating/system/classes/Kohana/Arr.php
+++ b/~dev_rating/system/classes/Kohana/Arr.php
@@ -10,7 +10,22 @@
  */
 class Kohana_Arr {
 
-	/**
+    public static function shuffle_assoc($list) {
+        if (!is_array($list))
+            return $list;
+
+        $keys = array_keys($list);
+        shuffle($keys);
+
+        $random = [];
+        foreach ($keys as &$key) {
+            $random[$key] = $list[$key];
+        }
+
+        return $random;
+    }
+
+    /**
 	 * @var  string  default delimiter for path()
 	 */
 	public static $delimiter = '.';