define(function (require/*, exports, module*/) {
    'use strict';

    var AnimationUtils   = brackets.getModule("utils/AnimationUtils"),
        AppInit          = brackets.getModule("utils/AppInit"),
        CodeInspection   = brackets.getModule("language/CodeInspection"),
        CommandManager   = brackets.getModule("command/CommandManager"),
        Commands         = brackets.getModule("command/Commands"),
        DefaultDialogs   = brackets.getModule("widgets/DefaultDialogs"),
        Dialogs          = brackets.getModule("widgets/Dialogs"),
        MainViewManager  = brackets.getModule("view/MainViewManager"),
        StatusBar        = brackets.getModule("widgets/StatusBar"),
        StringUtils      = brackets.getModule("utils/StringUtils"),
        _                = brackets.getModule("thirdparty/lodash");

    var linterReporter = require("linterReporter");

    var INDICATOR_ID = "interactive-linter-lint-indicator";
    var INDICATOR_CLASSES = "interactive-linter-lint-indicator";

    var DIALOG_TITLE = "Interactive Linter: Fatal Linter Error";
    var DIALOG_TEMPLATE = require("text!templates/errorDialog.html");

    var INDICATOR_TOOLTIPS = {
        OK: "Interactive Linter found no problems in code.",
        WARNING: "Interactive Linter found {0} problem(s) in code.",
        ERROR: "Interactive Linter encountered a fatal error, click for more details.",
        DISABLED: "Interactive Linter is disabled."
    };

    var INDICATOR_STATUS = {
        OK: 'okay',
        WARNING: 'warning',
        ERROR: 'error',
        DISABLED: 'inactive'
    };

    var $statusBarIndicator = $('<div>&nbsp;</div>');
    var dialogContent;

    AppInit.appReady(function () {
        StatusBar.addIndicator(INDICATOR_ID, $statusBarIndicator, true, INDICATOR_CLASSES);
        CodeInspection.toggleEnabled(false, true);

        $(MainViewManager).one("currentFileChange", function () {
            $('#status-inspection').hide();
            CommandManager.get(Commands.VIEW_TOGGLE_INSPECTION).setChecked(false);
            CommandManager.get(Commands.VIEW_TOGGLE_INSPECTION).setEnabled(false);
        });

        setStatusClass(INDICATOR_STATUS.DISABLED);
    });

    function removeStatusClasses() {
        _.forEach(INDICATOR_STATUS, function (statusClass) {
            $statusBarIndicator.removeClass(statusClass);
        });
    }

    function setStatusClass(status) {
        removeStatusClasses();
        $statusBarIndicator.addClass(status);
    }

    $(linterReporter).on("lintMessage", function (evt, messages) {
        lintMessageHandler(messages);
    });

    $(linterReporter).on("fatalError", function (evt, message) {
        fatalErrorHandler(message);
    });

    $statusBarIndicator.on('click', indicatorClickHandler);

    function indicatorClickHandler() {
        if ($statusBarIndicator.hasClass('error')) {
            Dialogs.showModalDialog(DefaultDialogs.DIALOG_ID_ERROR, DIALOG_TITLE, dialogContent);
        }
    }

    function fatalErrorHandler(message) {
        if (message) {
            setStatusClass(INDICATOR_STATUS.ERROR);
            $statusBarIndicator.attr('title', INDICATOR_TOOLTIPS.ERROR);

            AnimationUtils.animateUsingClass($statusBarIndicator, 'pulse', 2000);

            dialogContent = Mustache.render(DIALOG_TEMPLATE, {
                line: message.line,
                character: message.character,
                error: message.reason,
                href: message.href
            });
        }
    }

    function lintMessageHandler(messages) {
        if (messages === undefined || messages.length === 0) {
            setStatusClass(INDICATOR_STATUS.OK);
            $statusBarIndicator.attr('title', INDICATOR_TOOLTIPS.OK);
        }
        else if (messages.length > 0) {
            setStatusClass(INDICATOR_STATUS.WARNING);
            $statusBarIndicator.attr('title', StringUtils.format(INDICATOR_TOOLTIPS.WARNING, messages.length));
        }
    }
});

@@ -890,214 +890,22 @@
 var 
-INDICATOR_ID = %22interactive-linter-lint-indicator%22;%0A    var INDICATOR_CLASSES = %22interactive-linter-lint-indicator%22;%0A%0A    var DIALOG_TITLE = %22Interactive Linter: Fatal Linter Error%22;%0A    var DIALOG_TEMPLATE
+dialogTemplate
  = r
@@ -946,16 +946,39 @@
 .html%22);
+%0A    var dialogContent;
 %0A%0A    va
@@ -1475,559 +1475,8 @@
 %3E');
-%0A    var dialogContent;%0A%0A    AppInit.appReady(function () %7B%0A        StatusBar.addIndicator(INDICATOR_ID, $statusBarIndicator, true, INDICATOR_CLASSES);%0A        CodeInspection.toggleEnabled(false, true);%0A%0A        $(MainViewManager).one(%22currentFileChange%22, function () %7B%0A            $('#status-inspection').hide();%0A            CommandManager.get(Commands.VIEW_TOGGLE_INSPECTION).setChecked(false);%0A            CommandManager.get(Commands.VIEW_TOGGLE_INSPECTION).setEnabled(false);%0A        %7D);%0A%0A        setStatusClass(INDICATOR_STATUS.DISABLED);%0A    %7D);
 %0A%0A  
@@ -1774,293 +1774,8 @@
  %7D%0A%0A
-    $(linterReporter).on(%22lintMessage%22, function (evt, messages) %7B%0A        lintMessageHandler(messages);%0A    %7D);%0A%0A    $(linterReporter).on(%22fatalError%22, function (evt, message) %7B%0A        fatalErrorHandler(message);%0A    %7D);%0A%0A    $statusBarIndicator.on('click', indicatorClickHandler);%0A%0A
     
@@ -1934,20 +1934,48 @@
 OR, 
-DIALOG_TITLE
+%22Interactive Linter: Fatal Linter Error%22
 , di
@@ -2327,23 +2327,22 @@
 der(
-DIALOG_TEMPLATE
+dialogTemplate
 , %7B%0A
@@ -2987,13 +2987,867 @@
  %7D%0A    %7D
+%0A%0A    AppInit.appReady(function () %7B%0A        StatusBar.addIndicator(%22interactive-linter-lint-indicator%22, $statusBarIndicator, true, %22interactive-linter-lint-indicator%22);%0A        CodeInspection.toggleEnabled(false, true);%0A%0A        $(MainViewManager).one(%22currentFileChange%22, function () %7B%0A            $('#status-inspection').hide();%0A            CommandManager.get(Commands.VIEW_TOGGLE_INSPECTION).setChecked(false);%0A            CommandManager.get(Commands.VIEW_TOGGLE_INSPECTION).setEnabled(false);%0A        %7D);%0A%0A        setStatusClass(INDICATOR_STATUS.DISABLED);%0A    %7D);%0A%0A    $(linterReporter).on(%22lintMessage%22, function (evt, messages) %7B%0A        lintMessageHandler(messages);%0A    %7D);%0A%0A    $(linterReporter).on(%22fatalError%22, function (evt, message) %7B%0A        fatalErrorHandler(message);%0A    %7D);%0A%0A    $statusBarIndicator.on('click', indicatorClickHandler);
 %0A%7D);%0A

Move function definitions and properly format variables.