diff --git a/mod/quiz/classes/output/edit_renderer.php b/mod/quiz/classes/output/edit_renderer.php
index 6b29ee6..8cd58c5 100644
--- a/mod/quiz/classes/output/edit_renderer.php
+++ b/mod/quiz/classes/output/edit_renderer.php
@@ -152,7 +152,7 @@ class edit_renderer extends \plugin_renderer_base {
     /**
      * Render the form for setting a quiz' overall grade
      *
-     * @param stdClass $quiz the quiz settings from the database.
+     * @param \stdClass $quiz the quiz settings from the database.
      * @param \moodle_url $pageurl the canonical URL of this page.
      * @return string HTML to output.
      */
@@ -243,7 +243,7 @@ class edit_renderer extends \plugin_renderer_base {
     /**
      * Render the total marks available for the quiz.
      *
-     * @param stdClass $quiz the quiz settings from the database.
+     * @param \stdClass $quiz the quiz settings from the database.
      * @return string HTML to output.
      */
     public function total_marks($quiz) {
@@ -272,13 +272,12 @@ class edit_renderer extends \plugin_renderer_base {
     /**
      * Display the start of a section, before the questions.
      *
-     * @param stdClass $section The quiz_section entry from DB
+     * @param \stdClass $section The quiz_section entry from DB
      * @return string HTML to output.
      */
     protected function start_section($section) {
 
         $output = '';
-        $currenttext = '';
         $sectionstyle = '';
 
         $output .= html_writer::start_tag('li', array('id' => 'section-'.$section->id,
@@ -310,7 +309,7 @@ class edit_renderer extends \plugin_renderer_base {
     /**
      * Generate the content to be displayed on the left part of a section.
      *
-     * @param stdClass $section The quiz_section entry from DB
+     * @param \stdClass $section The quiz_section entry from DB
      * @return string HTML to output.
      */
     protected function section_left_content($section) {
@@ -320,7 +319,7 @@ class edit_renderer extends \plugin_renderer_base {
     /**
      * Generate the content to displayed on the right part of a section.
      *
-     * @param stdClass $section The quiz_section entry from DB
+     * @param \stdClass $section The quiz_section entry from DB
      * @return string HTML to output.
      */
     protected function section_right_content($section) {
@@ -333,9 +332,9 @@ class edit_renderer extends \plugin_renderer_base {
      * This function calls {@link core_course_renderer::quiz_section_question()}
      *
      * @param structure $structure object containing the structure of the quiz.
-     * @param stdClass $section information about the section.
+     * @param \stdClass $section information about the section.
      * @param \question_edit_contexts $contexts the relevant question bank contexts.
-     * @param array $pagevars the variables from {@link question_edit_setup()}.
+     * @param array $pagevars the variables from {@link \question_edit_setup()}.
      * @param \moodle_url $pageurl the canonical URL of this page.
      * @return string HTML to output.
      */
@@ -354,9 +353,9 @@ class edit_renderer extends \plugin_renderer_base {
      * Displays one question with the surrounding controls.
      *
      * @param structure $structure object containing the structure of the quiz.
-     * @param stdClass $question data from the question and quiz_slots tables.
+     * @param \stdClass $question data from the question and quiz_slots tables.
      * @param \question_edit_contexts $contexts the relevant question bank contexts.
-     * @param array $pagevars the variables from {@link question_edit_setup()}.
+     * @param array $pagevars the variables from {@link \question_edit_setup()}.
      * @param \moodle_url $pageurl the canonical URL of this page.
      * @return string HTML to output.
      */
@@ -403,7 +402,7 @@ class edit_renderer extends \plugin_renderer_base {
      * @param int $page the page number that this menu will add to.
      * @param \moodle_url $pageurl the canonical URL of this page.
      * @param \question_edit_contexts $contexts the relevant question bank contexts.
-     * @param array $pagevars the variables from {@link question_edit_setup()}.
+     * @param array $pagevars the variables from {@link \question_edit_setup()}.
      * @return string HTML to output.
      */
     public function add_menu_actions(structure $structure, $page, \moodle_url $pageurl,
@@ -443,7 +442,7 @@ class edit_renderer extends \plugin_renderer_base {
      * @param int $page the page number that this menu will add to.
      * @param \moodle_url $pageurl the canonical URL of this page.
      * @param \question_edit_contexts $contexts the relevant question bank contexts.
-     * @param array $pagevars the variables from {@link question_edit_setup()}.
+     * @param array $pagevars the variables from {@link \question_edit_setup()}.
      * @return array the actions.
      */
     public function edit_menu_actions(structure $structure, $page, \moodle_url $pageurl,
@@ -496,7 +495,7 @@ class edit_renderer extends \plugin_renderer_base {
      * @param structure $structure object containing the structure of the quiz.
      * @param int $page the page number that this menu will add to.
      * @param \moodle_url $pageurl the canonical URL of this page.
-     * @param array $pagevars the variables from {@link question_edit_setup()}.
+     * @param array $pagevars the variables from {@link \question_edit_setup()}.
      * @return string HTML to output.
      */
     protected function add_question_form(structure $structure, $page, \moodle_url $pageurl, array $pagevars) {
@@ -522,7 +521,7 @@ class edit_renderer extends \plugin_renderer_base {
      * Display a question.
      *
      * @param structure $structure object containing the structure of the quiz.
-     * @param stdClass $question data from the question and quiz_slots tables.
+     * @param \stdClass $question data from the question and quiz_slots tables.
      * @param \moodle_url $pageurl the canonical URL of this page.
      * @return string HTML to output.
      */
@@ -574,8 +573,8 @@ class edit_renderer extends \plugin_renderer_base {
     /**
      * Render the move icon.
      *
-     * @param stdClass $question data from the question and quiz_slots tables.
-     * @return The markup for the move action, or an empty string if not available.
+     * @param \stdClass $question data from the question and quiz_slots tables.
+     * @return string The markup for the move action, or an empty string if not available.
      */
     public function question_move_icon($question) {
         return html_writer::link(new \moodle_url('#'),
@@ -601,8 +600,8 @@ class edit_renderer extends \plugin_renderer_base {
     /**
      * Render the preview icon.
      *
-     * @param stdClass $quiz the quiz settings from the database.
-     * @param stdClass $question data from the question and quiz_slots tables.
+     * @param \stdClass $quiz the quiz settings from the database.
+     * @param \stdClass $question data from the question and quiz_slots tables.
      * @param bool $label if true, show the preview question label after the icon
      * @return string HTML to output.
      */
@@ -645,8 +644,8 @@ class edit_renderer extends \plugin_renderer_base {
     /**
      * Display an icon to split or join two pages of the quiz.
      *
-     * @param stdClass $quiz the quiz settings from the database.
-     * @param stdClass $question data from the question and quiz_slots tables.
+     * @param \stdClass $quiz the quiz settings from the database.
+     * @param \stdClass $question data from the question and quiz_slots tables.
      * @param string $insertpagebreak if true, show an insert page break icon.
      *      Else show a join pages icon.
      * @return string HTML to output.
@@ -682,7 +681,7 @@ class edit_renderer extends \plugin_renderer_base {
      * without a link
      *
      * @param structure $structure object containing the structure of the quiz.
-     * @param stdClass $question data from the question and quiz_slots tables.
+     * @param \stdClass $question data from the question and quiz_slots tables.
      * @param \moodle_url $pageurl the canonical URL of this page.
      * @return string HTML to output.
      */
@@ -719,7 +718,7 @@ class edit_renderer extends \plugin_renderer_base {
      * and also to see that category in the question bank.
      *
      * @param structure $structure object containing the structure of the quiz.
-     * @param stdClass $question data from the question and quiz_slots tables.
+     * @param \stdClass $question data from the question and quiz_slots tables.
      * @param \moodle_url $pageurl the canonical URL of this page.
      * @return string HTML to output.
      */
@@ -760,8 +759,8 @@ class edit_renderer extends \plugin_renderer_base {
     /**
      * Display the 'marked out of' information for a question.
      * Along with the regrade action.
-     * @param stdClass $quiz the quiz settings from the database.
-     * @param stdClass $question data from the question and quiz_slots tables.
+     * @param \stdClass $quiz the quiz settings from the database.
+     * @param \stdClass $question data from the question and quiz_slots tables.
      * @return string HTML to output.
      */
     public function marked_out_of_field($quiz, $question) {
@@ -795,7 +794,7 @@ class edit_renderer extends \plugin_renderer_base {
 
     /**
      * Render the contents of the question bank pop-up in its initial state,
-     * when it jsut contains a loading progress indicator.
+     * when it just contains a loading progress indicator.
      * @return string HTML to output.
      */
     public function question_bank_loading() {
@@ -808,7 +807,7 @@ class edit_renderer extends \plugin_renderer_base {
      * Return random question form.
      * @param \moodle_url $thispageurl the canonical URL of this page.
      * @param \question_edit_contexts $contexts the relevant question bank contexts.
-     * @param array $pagevars the variables from {@link question_edit_setup()}.
+     * @param array $pagevars the variables from {@link \question_edit_setup()}.
      * @return string HTML to output.
      */
     protected function random_question_form(\moodle_url $thispageurl, \question_edit_contexts $contexts, array $pagevars) {
@@ -831,8 +830,9 @@ class edit_renderer extends \plugin_renderer_base {
      * Initialise the JavaScript for the general editing. (JavaScript for popups
      * is handled with the specific code for those.)
      *
-     * @param stdClass $course the course settings from the database.
-     * @param stdClass $quiz the quiz settings from the database.
+     * @param \stdClass $course the course settings from the database.
+     * @param \stdClass $quiz the quiz settings from the database.
+     * @return bool Always returns true
      */
     protected function initialise_editing_javascript($course, $quiz) {
 
@@ -916,8 +916,8 @@ class edit_renderer extends \plugin_renderer_base {
     /**
      * Return the contents of the question bank, to be displayed in the question-bank pop-up.
      *
-     * @param quiz_question_bank_view $questionbank the question bank view object.
-     * @param array $pagevars the variables from {@link question_edit_setup()}.
+     * @param \quiz_question_bank_view $questionbank the question bank view object.
+     * @param array $pagevars the variables from {@link \question_edit_setup()}.
      * @return string HTML to output / send back in response to an AJAX request.
      */
     public function question_bank_contents(\quiz_question_bank_view $questionbank, array $pagevars) {
diff --git a/mod/quiz/classes/repaginate.php b/mod/quiz/classes/repaginate.php
index 9044db2..9b956f8 100644
--- a/mod/quiz/classes/repaginate.php
+++ b/mod/quiz/classes/repaginate.php
@@ -46,9 +46,9 @@ class repaginate {
     private $slots;
 
     /**
-     * Constuctor.
+     * Constructor.
      * @param int $quizid the id of the quiz being manipulated.
-     * @param object $slots the quiz_slots for that quiz.
+     * @param stdClass[] $slots the quiz_slots for that quiz.
      */
     public function __construct($quizid = 0, $slots = null) {
         global $DB;
@@ -65,8 +65,9 @@ class repaginate {
 
     /**
      * Repaginate a given slot with the given pagenumber.
-     * @param object $slot
+     * @param stdClass $slot
      * @param int $newpagenumber
+     * @return stdClass
      */
     protected function repaginate_this_slot($slot, $newpagenumber) {
         $newslot = clone($slot);
@@ -78,6 +79,7 @@ class repaginate {
      * Return current slot object.
      * @param array $slots
      * @param int $slotnumber
+     * @return stdClass $slot
      */
     protected function get_this_slot($slots, $slotnumber) {
         foreach ($slots as $key => $slot) {
@@ -90,7 +92,8 @@ class repaginate {
 
     /**
      * Return array of slots with slot number as key
-     * @param array $slots
+     * @param stdClass[] $slots
+     * @return stdClass[]
      */
     protected function get_slots_by_slot_number($slots) {
         if (!$slots) {
@@ -105,7 +108,8 @@ class repaginate {
 
     /**
      * Return array of slots with slot id as key
-     * @param array $slots
+     * @param stdClass[] $slots
+     * @return stdClass[]
      */
     protected function get_slots_by_slotid($slots) {
         if (!$slots) {
@@ -130,7 +134,7 @@ class repaginate {
         $newslots = array();
         foreach ($this->slots as $slot) {
             if ($slot->slot < $nextslotnumber) {
-                 $newslots[$slot->id] = $slot;
+                $newslots[$slot->id] = $slot;
             } else if ($slot->slot == $nextslotnumber) {
                 $nextslot = $this->repaginate_next_slot($nextslotnumber, $type);
 
@@ -138,7 +142,7 @@ class repaginate {
                 $DB->update_record('quiz_slots', $nextslot, true);
 
                 // Update returning object.
-                 $newslots[$slot->id] = $nextslot;
+                $newslots[$slot->id] = $nextslot;
             }
         }
         if ($nextslot) {
@@ -151,9 +155,9 @@ class repaginate {
      * Repaginate next slot and return the modified slot object
      * @param int $nextslotnumber
      * @param int $type repaginate::LINK or repaginate::UNLINK.
+     * @return stdClass|null
      */
     public function repaginate_next_slot($nextslotnumber, $type) {
-        global $DB;
         $currentslotnumber = $nextslotnumber - 1;
         if (!($currentslotnumber && $nextslotnumber)) {
             return null;
@@ -171,9 +175,9 @@ class repaginate {
 
     /**
      * Return the slots with the new pagination, regardless of current pagination.
-     * @param array $slots the slots to repaginate.
+     * @param stdClass[] $slots the slots to repaginate.
      * @param int $number number of question per page
-     * @return array the updated slots.
+     * @return stdClass[] the updated slots.
      */
     public function repaginate_n_question_per_page($slots, $number) {
         $slots = $this->get_slots_by_slot_number($slots);
@@ -193,11 +197,12 @@ class repaginate {
     }
 
     /**
-     * Repaginate the rest
-     * @param object $quizslots
+     * Repaginate the rest.
+     * @param stdClass[] $quizslots
      * @param int $slotfrom
      * @param int $type
      * @param bool $dbupdate
+     * @return stdClass[]
      */
     public function repaginate_the_rest($quizslots, $slotfrom, $type, $dbupdate = true) {
         global $DB;
diff --git a/mod/quiz/classes/structure.php b/mod/quiz/classes/structure.php
index 7db3e9a..bc4f0fd 100644
--- a/mod/quiz/classes/structure.php
+++ b/mod/quiz/classes/structure.php
@@ -24,7 +24,6 @@
 
 namespace mod_quiz;
 
-
 /**
  * Quiz structure class.
  *
@@ -42,19 +41,19 @@ class structure {
     protected $quizobj = null;
 
     /**
-     * @var stdClass[] the questions in this quiz. Contains the row from the questions
+     * @var \stdClass[] the questions in this quiz. Contains the row from the questions
      * table, with the data from the quiz_slots table added, and also question_categories.contextid.
      */
     protected $questions = array();
 
-    /** @var stdClass[] quiz_slots.id => the quiz_slots rows for this quiz, agumented by sectionid. */
+    /** @var \stdClass[] quiz_slots.id => the quiz_slots rows for this quiz, agumented by sectionid. */
     protected $slots = array();
 
-    /** @var stdClass[] quiz_slots.slot => the quiz_slots rows for this quiz, agumented by sectionid. . */
+    /** @var \stdClass[] quiz_slots.slot => the quiz_slots rows for this quiz, agumented by sectionid. . */
     protected $slotsinorder = array();
 
     /**
-     * @var stdClass[] currently a dummy. Holds data that will match the
+     * @var \stdClass[] currently a dummy. Holds data that will match the
      * quiz_sections, once it exists.
      */
     protected $sections = array();
@@ -83,7 +82,7 @@ class structure {
 
     /**
      * Create an instance of this class representing the structure of a given quiz.
-     * @param quiz $quizobj the quiz.
+     * @param \quiz $quizobj the quiz.
      * @return structure
      */
     public static function create_for_quiz($quizobj) {
@@ -94,7 +93,7 @@ class structure {
 
     /**
      * Whether there are any questions in the quiz.
-     * @return boolean true if there is at least one question in the quiz.
+     * @return bool true if there is at least one question in the quiz.
      */
     public function has_questions() {
         return !empty($this->questions);
@@ -194,7 +193,7 @@ class structure {
 
     /**
      * Get quiz slots.
-     * @return stdClass[] the slots in this quiz.
+     * @return \stdClass[] the slots in this quiz.
      */
     public function get_slots() {
         return $this->slots;
@@ -203,7 +202,7 @@ class structure {
     /**
      * Is this slot the first one on its page?
      * @param int $slotnumber the index of the slot in question.
-     * @return boolean whether this slot the first one on its page.
+     * @return bool whether this slot the first one on its page.
      */
     public function is_first_slot_on_page($slotnumber) {
         if ($slotnumber == 1) {
@@ -215,7 +214,7 @@ class structure {
     /**
      * Is this slot the last one on its page?
      * @param int $slotnumber the index of the slot in question.
-     * @return boolean whether this slot the last one on its page.
+     * @return bool whether this slot the last one on its page.
      */
     public function is_last_slot_on_page($slotnumber) {
         if (!isset($this->slotsinorder[$slotnumber + 1])) {
@@ -227,7 +226,7 @@ class structure {
     /**
      * Is this slot the last one in the quiz?
      * @param int $slotnumber the index of the slot in question.
-     * @return boolean whether this slot the last one in the quiz.
+     * @return bool whether this slot the last one in the quiz.
      */
     public function is_last_slot_in_quiz($slotnumber) {
         end($this->slotsinorder);
@@ -236,7 +235,7 @@ class structure {
 
     /**
      * Get the final slot in the quiz.
-     * @return stdClass the quiz_slots for for the final slot in the quiz.
+     * @return \stdClass the quiz_slots for for the final slot in the quiz.
      */
     public function get_last_slot() {
         return end($this->slotsinorder);
@@ -245,7 +244,7 @@ class structure {
     /**
      * Get a slot by it's id. Throws an exception if it is missing.
      * @param int $slotid the slot id.
-     * @return stdClass the requested quiz_slots row.
+     * @return \stdClass the requested quiz_slots row.
      */
     public function get_slot_by_id($slotid) {
         if (!array_key_exists($slotid, $this->slots)) {
@@ -257,7 +256,7 @@ class structure {
     /**
      * Get all the questions in a section of the quiz.
      * @param int $sectionid the section id.
-     * @return array of question/slot objects.
+     * @return \stdClass[] of question/slot objects.
      */
     public function get_questions_in_section($sectionid) {
         $questions = array();
@@ -271,7 +270,7 @@ class structure {
 
     /**
      * Get all the sections of the quiz.
-     * @return stdClass[] the sections in this quiz.
+     * @return \stdClass[] the sections in this quiz.
      */
     public function get_quiz_sections() {
         return $this->sections;
@@ -279,7 +278,7 @@ class structure {
 
     /**
      * Get any warnings to show at the top of the edit page.
-     * @return array of strings.
+     * @return string[] array of strings.
      */
     public function get_edit_page_warnings() {
         $warnings = array();
@@ -303,7 +302,7 @@ class structure {
 
     /**
      * Get the date information about the current state of the quiz.
-     * @return array of two strings. First a short summary, then a longer
+     * @return string[] array of two strings. First a short summary, then a longer
      * explanation of the current state, e.g. for a tool-tip.
      */
     public function get_dates_summary() {
@@ -397,8 +396,8 @@ class structure {
 
     /**
      * Used by populate. Make up fake data for any missing questions.
-     * @param array $slots the data about the slots and questions in the quiz.
-     * @return array updated $slots array.
+     * @param \stdClass[] $slots the data about the slots and questions in the quiz.
+     * @return \stdClass[] updated $slots array.
      */
     protected function populate_missing_questions($slots) {
         // Address missing question types.
@@ -539,9 +538,9 @@ class structure {
 
     /**
      * Refresh page numbering of quiz slots.
-     * @param object $quiz the quiz object.
-     * @param array  $slots (optional) array of slot objects.
-     * @return array of slot objects.
+     * @param \stdClass $quiz the quiz object.
+     * @param \stdClass[] $slots (optional) array of slot objects.
+     * @return \stdClass[] array of slot objects.
      */
     public function refresh_page_numbers($quiz, $slots=array()) {
         global $DB;
@@ -570,8 +569,8 @@ class structure {
 
     /**
      * Refresh page numbering of quiz slots and save to the database.
-     * @param object $quiz the quiz object.
-     * @return array of slot objects.
+     * @param \stdClass $quiz the quiz object.
+     * @return \stdClass[] array of slot objects.
      */
     public function refresh_page_numbers_and_update_db($quiz) {
         global $DB;
@@ -588,7 +587,7 @@ class structure {
 
     /**
      * Remove a slot from a quiz
-     * @param object $quiz the quiz object.
+     * @param \stdClass $quiz the quiz object.
      * @param int $slotnumber The number of the slot to be deleted.
      */
     public function remove_slot($quiz, $slotnumber) {
@@ -625,8 +624,8 @@ class structure {
      * corresponding question_attempts.
      * It does not update 'sumgrades' in the quiz table.
      *
-     * @param stdClass $slot    row from the quiz_slots table.
-     * @param float    $maxmark the new maxmark.
+     * @param \stdClass $slot row from the quiz_slots table.
+     * @param float $maxmark the new maxmark.
      * @return bool true if the new grade is different from the old one.
      */
     public function update_slot_maxmark($slot, $maxmark) {
@@ -653,10 +652,10 @@ class structure {
      * Saves changes to the slot page relationship in the quiz_slots table and reorders the paging
      * for subsequent slots.
      *
-     * @param object $quiz the quiz object.
-     * @param int    $slotid id of slot.
-     * @param int    $type repaginate::LINK or repaginate::UNLINK.
-     * @return array of slot objects.
+     * @param \stdClass $quiz the quiz object.
+     * @param int $slotid id of slot.
+     * @param int $type repaginate::LINK or repaginate::UNLINK.
+     * @return \stdClass[] array of slot objects.
      */
     public function update_page_break($quiz, $slotid, $type) {
         global $DB;
diff --git a/mod/quiz/editlib.php b/mod/quiz/editlib.php
index e7a6a67..871dc17 100644
--- a/mod/quiz/editlib.php
+++ b/mod/quiz/editlib.php
@@ -376,8 +376,6 @@ class quiz_question_bank_view extends core_question\bank\view {
      * @param array    $addcontexts contexts where the user is allowed to add new questions.
      */
     protected function display_bottom_controls($totalnumber, $recurse, $category, \context $catcontext, array $addcontexts) {
-        global $OUTPUT;
-
         $cmoptions = new \stdClass();
         $cmoptions->hasattempts = !empty($this->quizhasattempts);
 
diff --git a/mod/quiz/upgrade.txt b/mod/quiz/upgrade.txt
index b40256d..911e92c 100644
--- a/mod/quiz/upgrade.txt
+++ b/mod/quiz/upgrade.txt
@@ -10,7 +10,7 @@ This files describes API changes in the quiz code.
   Display of mod/quiz/edit.php is now entirely generated by
   mod_quiz\output\edit_renderer. This uses a helper class mod_quiz\structure
   to provide details of the structure of the quiz, and mod_quiz\repaginate to
-  alter that structure. (Acutally, there are still some modification methods on
+  alter that structure. (Actually, there are still some modification methods on
   mod_quiz\structure. Expect that to be cleaned up in future.)
 
   The new code uses much more ajax, and there are new scripts mod/quiz/edit_rest.php
@@ -23,7 +23,7 @@ This files describes API changes in the quiz code.
 
   Here is a list of all the old functions or classes that have changed.
   If you used any of these in custom code, you will need to update your code.
-  (Note that many of these function should have been considered private internals
+  (Note that many of these functions should have been considered private internals
   of the quiz module, and you should not have been using them!)
 
   From editlib.php:
diff --git a/mod/quiz/yui/src/dragdrop/js/resource.js b/mod/quiz/yui/src/dragdrop/js/resource.js
index f3509ab..f4fdd46 100644
--- a/mod/quiz/yui/src/dragdrop/js/resource.js
+++ b/mod/quiz/yui/src/dragdrop/js/resource.js
@@ -110,7 +110,7 @@ Y.extend(DRAGRESOURCE, M.core.dragdrop, {
 
     drag_dropmiss: function(e) {
         // Missed the target, but we assume the user intended to drop it
-        // on the last last ghost node location, e.drag and e.drop should be
+        // on the last ghost node location, e.drag and e.drop should be
         // prepared by global_drag_dropmiss parent so simulate drop_hit(e).
         this.drop_hit(e);
     },
