diff --git a/include/class.config.php b/include/class.config.php
index cb7cd40aed575013ee1db136d15037438d6b34fb..8ff0056184713797a87e92871a272e5c953bb39e 100644
--- a/include/class.config.php
+++ b/include/class.config.php
@@ -81,8 +81,9 @@ class Config {
 
         if($this->config['schema_signature'])
             return $this->config['schema_signature'];
-        elseif($this->config['ostversion']) //old version 1.6 st.
-            return md5(strtoupper($this->config['ostversion']));
+
+        if($this->config['ostversion']) //old version 1.6 RC[1-5]-ST
+            return md5(strtoupper(trim($this->config['ostversion'])));
 
         return null;
     }
diff --git a/include/class.migrater.php b/include/class.migrater.php
index de8a3d9590e97b9d78ecb905528bcbc1bc2c03a5..a575f62c5046007786dae9e9193eb864f5644d76 100644
--- a/include/class.migrater.php
+++ b/include/class.migrater.php
@@ -2,13 +2,8 @@
 /*********************************************************************
     class.migrater.php
 
-    SQL database migrater. This provides the engine capable of rolling the
-    database for an osTicket installation forward (and perhaps even
-    backward) in time using a set of included migration scripts. Each script
-    will roll the database between two database checkpoints. Where possible,
-    the migrater will roll several checkpoint scripts into one to be applied
-    together.
-
+    Migration utils required by upgrader.
+    
     Jared Hancock <jared@osticket.com>
     Copyright (c)  2006-2012 osTicket
     http://www.osticket.com
@@ -19,6 +14,19 @@
     vim: expandtab sw=4 ts=4 sts=4:
 **********************************************************************/
 
+
+/*
+    DatabaseMigrater.
+
+    SQL database migrater. This provides the engine capable of rolling the
+    database for an osTicket installation forward (and perhaps even
+    backward) in time using a set of included migration scripts. Each script
+    will roll the database between two database checkpoints. Where possible,
+    the migrater will roll several checkpoint scripts into one to be applied
+    together.
+
+*/
+
 class DatabaseMigrater {
 
     var $start;
@@ -64,4 +72,169 @@ class DatabaseMigrater {
         return $patches;
     }
 }
+
+
+/*
+    AttachmentMigrater
+
+    Attachment migration from file-based attachments in pre-1.7 to
+    database-backed attachments in osTicket v1.7. This class provides the
+    hardware to find and retrieve old attachments and move them into the new
+    database scheme with the data in the actual database.
+
+    Copyright (c)  2006-2012 osTicket
+    http://www.osticket.com
+
+    Released under the GNU General Public License WITHOUT ANY WARRANTY.
+    See LICENSE.TXT for details.
+
+    vim: expandtab sw=4 ts=4 sts=4:
+*/
+
+include_once(INCLUDE_DIR.'class.file.php');
+
+class AttachmentMigrater {
+    function AttachmentMigrater() {
+        $this->queue = array();
+        $this->current = 0;
+        $this->errors = 0;
+        $this->errorList = array();
+    }
+    /**
+     * Identifies attachments in need of migration and queues them for
+     * migration to the new database schema.
+     * 
+     * @see ::next() for output along the way
+     *
+     * Returns:
+     * TRUE/FALSE to indicate if migration finished without any errors
+     */
+    function start_migration() {
+        $this->findAttachments();
+        $this->total = count($this->queue);
+    }
+    /**
+     * Process the migration for a unit of time. This will be used to
+     * overcome the execution time restriction of PHP. This instance can be
+     * stashed in a session and have this method called periodically to
+     * process another batch of attachments
+     */
+    function do_batch($max, $time=20) {
+        $start = time();
+        $this->errors = 0;
+        while (count($this->queue) && $count++ < $max && time()-$start < $time)
+            $this->next();
+        # TODO: Log success/error indication of migration of attachments
+        return (!$this->errors);
+    }
+
+    function queue($fileinfo) {
+        $this->queue[] = $fileinfo;
+    }
+    function getQueueLength() { return count($this->queue); }
+    /**
+     * Processes the next item on the work queue. Emits a JSON messages to
+     * indicate current progress.
+     *
+     * Returns:
+     * TRUE/NULL if the migration was successful
+     */
+    function next() {
+        # Fetch next item -- use the last item so the array indices don't
+        # need to be recalculated for every shift() operation.
+        $info = array_pop($this->queue);
+        # Attach file to the ticket
+        if (!($info['data'] = @file_get_contents($info['path']))) {
+            # Continue with next file
+            return $this->error(
+                sprintf('%s: Cannot read file contents', $info['path']));
+        }
+        # Get the mime/type of each file
+        # XXX: Use finfo_buffer for PHP 5.3+
+        $info['type'] = mime_content_type($info['path']);
+        if (!($fileId = AttachmentFile::save($info))) {
+            return $this->error(
+                sprintf('%s: Unable to migrate attachment', $info['path']));
+        }
+        # Update the ATTACHMENT_TABLE record to set file_id
+        db_query('update '.TICKET_ATTACHMENT_TABLE
+                .' set file_id='.db_input($fileId)
+                .' where attach_id='.db_input($info['attachId']));
+        # Remove disk image of the file. If this fails, the migration for
+        # this file would not be retried, because the file_id in the
+        # TICKET_ATTACHMENT_TABLE has a nonzero value now
+        if (!@unlink($info['path']))
+            $this->error(
+                sprintf('%s: Unable to remove file from disk',
+                $info['path']));
+        # TODO: Log an internal note to the ticket?
+        return true;
+    }
+    /**
+     * From (class Ticket::fixAttachments), used to detect the locations of
+     * attachment files
+     */
+    /* static */ function findAttachments(){
+        global $cfg;
+
+        $res=db_query('SELECT attach_id, file_name, file_key, Ti.created'
+            .' FROM '.TICKET_ATTACHMENT_TABLE.' TA'
+            .' JOIN '.TICKET_TABLE.' Ti ON Ti.ticket_id=TA.ticket_id'
+            .' WHERE NOT file_id');
+        if (!$res) {
+            return $this->error('Unable to query for attached files');
+        } elseif (!db_num_rows($res)) {
+            return true;
+        }
+        $dir=$cfg->getUploadDir();
+        while (list($id,$name,$key,$created)=db_fetch_row($res)) {
+            $month=date('my',strtotime($created));
+            $info=array(
+                'name'=>        $name,
+                'attachId'=>    $id,
+            );
+            $filename15=sprintf("%s/%s_%s",rtrim($dir,'/'),$key,$name);
+            $filename16=sprintf("%s/%s/%s_%s",rtrim($dir,'/'),$month,$key,$name); //new destination.
+            if (file_exists($filename15)) { 
+                $info['path'] = $filename15;
+            } elseif (file_exists($filename16)) {  
+                $info['path'] = $filename16;
+            } else {
+                # XXX Cannot find file for attachment
+                $this->error(sprintf('%s: Unable to locate attachment file',
+                    $name));
+                # No need to further process this file
+                continue;
+            }
+            # TODO: Get the size and mime/type of each file.
+            #
+            # NOTE: If filesize() fails and file_get_contents() doesn't,
+            # then the AttachmentFile::save() method will automatically
+            # estimate the filesize based on the length of the string data
+            # received in $info['data'] -- ie. no need to do that here.
+            #
+            # NOTE: The size is done here because it should be quick to
+            # lookup out of file inode already loaded. The mime/type may
+            # take a while because it will require a second IO to read the
+            # file data.  To ensure this will finish before the
+            # max_execution_time, perform the type match in the ::next()
+            # method since the entire file content will be read there
+            # anyway.
+            $info['size'] = @filesize($info['path']);
+            # Coroutines would be nice ..
+            $this->queue($info);
+        }
+    }
+
+    function error($what) {
+        $this->errors++;
+        $this->errorList[] = $what;
+        # Assist in returning FALSE for inline returns with this method
+        return false;
+    }
+    function getErrors() {
+        return $this->errorList;
+    }
+}
+
 ?>
diff --git a/include/class.osticket.php b/include/class.osticket.php
index 78e249d50436b451acabe7a90db69d578d502c2c..49e55e923e65e5f4366926b0dd81dbb4612b3a5e 100644
--- a/include/class.osticket.php
+++ b/include/class.osticket.php
@@ -43,7 +43,7 @@ class osTicket {
     }
 
     function isUpgradePending() {
-        return (defined('SCHEMA_SIGNATURE') && strcasecmp($this->getConfig()->getSchemaSignature(), SCHEMA_SIGNATURE));
+        return (defined('SCHEMA_SIGNATURE') && strcasecmp($this->getDBSignature(), SCHEMA_SIGNATURE));
     }
 
     function getSession() {
@@ -59,6 +59,14 @@ class osTicket {
         return $this->getConfig()?$this->getConfig()->getId():0;
     }
 
+    function getDBSignature() {
+        return $this->getConfig()->getSchemaSignature();
+    }
+
+    function getVersion() {
+        return THIS_VERSION;
+    }
+
     function addExtraHeader($header) {
         $this->headers[md5($header)] = $header;
     }
diff --git a/include/class.setup.php b/include/class.setup.php
index 438eca54505302a30d6da9575067c90b296369dc..a49f87f138f65c2e3f80213e5d6b0f6f27cae6d1 100644
--- a/include/class.setup.php
+++ b/include/class.setup.php
@@ -21,14 +21,17 @@ Class SetupWizard {
                         'mysql' => '4.4');
 
     //Version info - same as the latest version.
-    var $version ='1.7-dpr3';
-    var $version_verbose='1.7 DPR 3';
+    
+    var $version =THIS_VERSION;
+    var $version_verbose = THIS_VERSION;
 
     //Errors
     var $errors=array();
 
     function SetupWizard(){
         $this->errors=array();
+        $this->version_verbose = ('osTicket v'. strtoupper(THIS_VERSION));
+
     }
 
     function load_sql_file($file, $prefix, $abort=true, $debug=false) {
diff --git a/include/class.upgrader.php b/include/class.upgrader.php
index 891d472d9264a78501bac8ec6d7a4d28abf8553c..58e6072282e2fc54d4125c1e9219339064e24263 100644
--- a/include/class.upgrader.php
+++ b/include/class.upgrader.php
@@ -14,8 +14,8 @@
     vim: expandtab sw=4 ts=4 sts=4:
 **********************************************************************/
 
-require_once INC_DIR.'class.setup.php';
-require_once INC_DIR.'class.migrater.php';
+require_once INCLUDE_DIR.'class.setup.php';
+require_once INCLUDE_DIR.'class.migrater.php';
 
 class Upgrader extends SetupWizard {
 
@@ -181,6 +181,7 @@ class Upgrader extends SetupWizard {
             return true; //Nothing to do.
 
         foreach($tasks as $k => $task) {
+            //TODO: check time used vs. max execution - break if need be
             if(call_user_func(array($this, $task['func']), $k)===0) {
                 $this->tasks[$k]['done'] = true;
             } else { //Task has pending items to process.
@@ -198,6 +199,7 @@ class Upgrader extends SetupWizard {
             return false;
 
         foreach ($patches as $patch) {
+            //TODO: check time used vs. max execution - break if need be
             if (!$this->load_sql_file($patch, $this->getTablePrefix()))
                 return false;
 
@@ -232,13 +234,13 @@ class Upgrader extends SetupWizard {
 
         $tasks=array();
         switch($phash) { //Add  patch specific scripted tasks.
-            case 'd4fe13b1-7be60a84': //V1.6 ST- 1.7 *
+            case 'c00511c7-7be60a84': //V1.6 ST- 1.7 * {{MD5('1.6 ST') -> c00511c7c1db65c0cfad04b4842afc57}}
                 $tasks[] = array('func' => 'migrateAttachments2DB',
                                  'desc' => 'Migrating attachments to database, it might take a while depending on the number of files.');
                 break;
         }
 
-        //Check if cleanup p 
+        //Check IF SQL cleanup is exists. 
         $file=$this->getSQLDir().$phash.'.cleanup.sql';
         if(file_exists($file)) 
             $tasks[] = array('func' => 'cleanup', 'desc' => 'Post-upgrade cleanup!');
@@ -261,10 +263,9 @@ class Upgrader extends SetupWizard {
         //XXX: ???
         return false;
     }
-    
 
     function migrateAttachments2DB($tId=0) {
-        echo "Process attachments here - $tId";
+        
         $att_migrater = new AttachmentMigrater();
         $att_migrater->start_migration();
         # XXX: Loop here (with help of task manager)
diff --git a/include/upgrader/aborted.inc.php b/include/upgrader/aborted.inc.php
index 8624590d35710a42906952afab82b2688f028315..50f34c721102d9ab5a99e446c6cfda3f2a53ec20 100644
--- a/include/upgrader/aborted.inc.php
+++ b/include/upgrader/aborted.inc.php
@@ -1,10 +1,12 @@
 <?php
-if(!defined('SETUPINC')) die('Kwaheri!');
+if(!defined('OSTADMININC') || !$thisstaff || !$thisstaff->isAdmin()) die('Access Denied');
 ?>    
-<div id="main">
+<div id="upgrader">
+   <div id="main">
     <h1 style="color:#FF7700;">Upgrade Aborted!</h1>
     <div id="intro">
-        <p>Upgrade aborted due to errors. Any errors at this stage are fatal. Please note the error(s), if any, when contacting us.<p>
+        <p><strong>Upgrade aborted due to errors. Any errors at this stage are fatal.</strong></p>
+        <p>Please note the error(s), if any, when <a target="_blank" href="http://osticket.com/support/">seeking help</a>.<p>
         <?php
         if($upgrader && ($errors=$upgrader->getErrors())) {
             if($errors['err'])
@@ -20,9 +22,11 @@ if(!defined('SETUPINC')) die('Kwaheri!');
         ?>
         <p>Please, refer to the <a target="_blank" href="http://osticket.com/wiki/Upgrade_and_Migration">Upgrade Guide</a> on the wiki for more information.</p>
     </div>
-    <p><strong>Need Help?</strong> We provide <a target="_blank" href="http://osticket.com/support/professional_services.php"><u>professional upgrade services</u></a> and commercial support. <a target="_blank" href="http://osticket.com/support/">Contact us</a> today for expedited help.</p>
-</div>    
-<div id="sidebar">
+    <p><strong>Need Help?</strong> We provide <a target="_blank" href="http://osticket.com/support/professional_services.php"><u>professional upgrade services</u></a> and commercial support. <a target="_blank" href="http://osticket.com/support/">Contact us</a> today for <u>expedited</u> help.</p>
+  </div>    
+  <div id="sidebar">
     <h3>What to do?</h3>
     <p>Restore your previous version from backup and try again or <a target="_blank" href="http://osticket.com/support/">seek help</a>.</p>    
+  </div>
+  <div class="clear"></div>
 </div>
diff --git a/include/upgrader/done.inc.php b/include/upgrader/done.inc.php
index 0ec75c31a8099d5c0877231a00e274400a97f049..e229fd3280113793ca8dab136685d2254a4a3199 100644
--- a/include/upgrader/done.inc.php
+++ b/include/upgrader/done.inc.php
@@ -1,20 +1,16 @@
-<?php if(!defined('SETUPINC')) die('Kwaheri!');
-$url=URL;
-
-?>    
+<?php
+if(!defined('OSTADMININC') || !$thisstaff || !$thisstaff->isAdmin()) die('Access Denied');
+?> 
+<div id="upgrader">
     <div id="main">
         <h1 style="color:green;">Upgrade Completed!</h1>
         <div id="intro">
-        <p>Congratulations osTicket upgrade has been completed successfully. Please refer to Release Notes for more information about changes and/or new features.</p>
-        <h3 style="color:#FF7700;">Post-upgrade manual cleanup</h3>
-        Please take a minute to cleanup!
-        <ul>
-            <li><b>Delete setup directory</b>:<br> After verifying that the upgrade completed correctly please delete setup folder.</li>
-            <li><b>Enable the helpdesk</b>:<br> You can now enable osTicket, be sure to take some time to explore changes and new features</li>
-        </ul>
+        <p>Congratulations osTicket upgrade has been completed successfully.</p>
+        <p>Please refer to <a href="http://osticket.com/wiki/Release_Notes" target="_blank">Release Notes</a> for more information about changes and/or new features.</p>
         </div>
-        <p>Once again, thank you for choosing osTicket. Your feedback is welcomed!</p>
-        <p>We take user feedback seriously and are dedicated to making changes based on your input. Feel free to let us know of any other improvements you would like to see in osTicket, so that we may add them in the future as we continue to develop better and better versions of osTicket.</p>
+        <p>Once again, thank you for choosing osTicket.</p>
+        <p>Please feel free to <a target="_blank" href="http://osticket.com/support/">let us know</a> of any other improvements and features you would like to see in osTicket, so that we may add them in the future as we continue to develop better and better versions of osTicket.</p>
+        <p>We take user feedback seriously and we're dedicated to making changes based on your input.</p>
         <p>Good luck.<p>
         <p>osTicket Team.</p>
         <br>
@@ -22,9 +18,10 @@ $url=URL;
     </div>
     <div id="sidebar">
             <h3>What's Next?</h3>
-            <p><b>Post-upgrade</b>: You can now log in to <a href="../scp/admin.php" target="_blank">Admin Panel</a> and explore the new features. For complete and upto date release notes see <a href="http://osticket.com/wiki/Post-Install_Setup_Guide" target="_blank">osTicket wiki</a></p>
-          
+            <p><b>Post-upgrade</b>: You can now go to <a href="scp/settings.php" target="_blank">Admin Panel</a> to enable the system and explore the new features. For complete and upto date release notes see <a href="http://osticket.com/wiki/Release_Notes" target="_blank">osTicket wiki</a></p>
             <p><b>Stay up to date</b>: It's important to keep your osTicket installation up to date. Get announcements, security updates and alerts delivered directly to you! 
-            <a target="_blank" href="http://osticket.com/support/subscribe.php">Subcribe today</a> and be in the loop!</p>
+            <a target="_blank" href="http://osticket.com/support/subscribe.php">Get in the loop</a> today and stay informed!</p>
             <p><b>Commercial support available</b>: Get guidance and hands-on expertise to address unique challenges and make sure your osTicket runs smoothly, efficiently, and securely. <a target="_blank" href="http://osticket.com/support/commercial_support.php.php">Learn More!</a></p>
    </div>
+   <div class="clear"></div>
+</div>
diff --git a/include/upgrader/patches/c00511c7-7be60a84.patch.sql b/include/upgrader/patches/c00511c7-7be60a84.patch.sql
index 3a2acf2295170c9b6263b33f05d649c378ed5dbb..e9aef8d380e34c69ad6d696e3c018cc10ae8b4c3 100644
--- a/include/upgrader/patches/c00511c7-7be60a84.patch.sql
+++ b/include/upgrader/patches/c00511c7-7be60a84.patch.sql
@@ -1,3 +1,8 @@
+/**
+ * @version v1.7-*
+ * @schema c00511c7c1db65c0cfad04b4842afc57
+ */
+
 -- Add a table to contain the attachment file contents
 DROP TABLE IF EXISTS `%TABLE_PREFIX%file`;
 CREATE TABLE `%TABLE_PREFIX%file` (
@@ -287,3 +292,6 @@ CREATE TABLE IF NOT EXISTS `%TABLE_PREFIX%faq_topic` (
   `topic_id` int(10) unsigned NOT NULL,
   PRIMARY KEY  (`faq_id`,`topic_id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+UPDATE `%TABLE_PREFIX%config`
+    SET `schema_signature`='7be60a8432e44989e782d5914ef784d2'; 
diff --git a/include/upgrader/prereq.inc.php b/include/upgrader/prereq.inc.php
index 5f60cece25500679de83b01981ea05ac634949e9..d5b7591728b0f3b0907fc5b9529f392b13ccde1d 100644
--- a/include/upgrader/prereq.inc.php
+++ b/include/upgrader/prereq.inc.php
@@ -1,10 +1,10 @@
 <?php
-if(!defined('SETUPINC')) die('Kwaheri!');
-
+if(!defined('OSTADMININC') || !$thisstaff || !$thisstaff->isAdmin()) die('Access Denied');
 ?>
+<h2>osTicket Upgrader</h2>
+<div id="upgrader">
+    
     <div id="main">
-            <h1>osTicket Upgrade!</h1>
-            <font color="red"><b><?php echo $errors['err']; ?></b></font>
             <div id="intro">
              <p>Thank you for being a loyal osTicket user!</p>
              <p>The upgrade wizard will guide you every step of the way in the upgrade process. While we try to ensure that the upgrade process is straightforward and painless, we can't guarantee it will be the case for every user.</p>
@@ -22,7 +22,6 @@ if(!defined('SETUPINC')) die('Kwaheri!');
             <h3>Higly Recommended:</h3>
             We hightly recommend that you follow the steps below.
             <ul>
-                <li>Take osTicket offline momentarily during upgrade.</li>
                 <li>Backup the current database, if you haven't done so already.</li>
                 <li>Be patient the upgrade process will take a couple of seconds.</li>
             </ul>
@@ -36,15 +35,17 @@ if(!defined('SETUPINC')) die('Kwaheri!');
     <div id="sidebar">
             <h3>Upgrade Tips</h3>
             <p>1. Remember to backup your osTicket database</p>
-            <p>2. Take osTicket offline momentarily</p>
+            <p>2. Refer to <a href="http://osticket.com/wiki/Upgrade_and_Migration" target="_blank">Upgrade Guide</a> for the latest tips</a>
             <p>3. If you experience any problems, you can always restore your files/dabase backup.</p>
             <p>4. We can help, feel free to <a href="http://osticket.com/support/" target="_blank">contact us </a> for professional help.</p>
 
     </div>
-
-    <div id="overlay"></div>
-    <div id="loading">
-        <h4>Doing stuff!</h4>
-        Please wait... while we upgrade your osTicket installation!
-        <div id="udb"></div>
-    </div>
+    <div class="clear"></div>
+</div>
+    
+<div id="overlay"></div>
+<div id="loading">
+    <h4>Doing stuff!</h4>
+    Please wait... while we upgrade your osTicket installation!
+    <div id="msg"></div>
+</div>
diff --git a/include/upgrader/upgrade.inc.php b/include/upgrader/upgrade.inc.php
index 6f05cd169c66d49163908d8a6c6bef9d5b9a1a18..2af78a9d6e7e4b1727c5ee2cca45b73674ef25fa 100644
--- a/include/upgrader/upgrade.inc.php
+++ b/include/upgrader/upgrade.inc.php
@@ -1,14 +1,13 @@
 <?php
-if(!defined('SETUPINC') || !$upgrader)  die('Kwaheri!');
+if(!defined('OSTADMININC') || !$thisstaff || !$thisstaff->isAdmin()) die('Access Denied');
 $action=$upgrader->getNextAction();
-
 ?>
+<h2>osTicket Upgrade</h2>
+<div id="upgrader">
     <div id="main">
-            <h1>osTicket Upgrade</h1>
             <div id="intro">
              <p>Thank you for taking the time to upgrade your osTicket intallation!</p>
-             <p>Please don't cancel or close the browser, any errors at this
-              stage will be fatal.</p>
+             <p>Please don't cancel or close the browser, any errors at this stage will be fatal.</p>
             </div>
             <h2><?php echo $action ?></h2>
             <p>The upgrade wizard will now attempt to upgrade your database and core settings!</p>
@@ -28,13 +27,15 @@ $action=$upgrader->getNextAction();
     <div id="sidebar">
             <h3>Upgrade Tips</h3>
             <p>1. Be patient the process will take a couple of seconds.</p>
-            <p>2. If you experience any problems, you can always restore your files/dabase backup.</p>
+            <p>2. If you experience any problems, you can always restore your files/database backup.</p>
             <p>3. We can help, feel free to <a href="http://osticket.com/support/" target="_blank">contact us </a> for professional help.</p>
     </div>
-
+    <div class="clear"></div>
     <div id="overlay"></div>
     <div id="loading">
         <h4><?php echo $action; ?></h4>
         Please wait... while we upgrade your osTicket installation!
         <div id="msg" style="font-weight: bold;padding-top:10px;">Smile!</div>
     </div>
+</div>
+<div class="clear"></div>`
diff --git a/scp/admin.inc.php b/scp/admin.inc.php
index 89e234e2f13e14204701348fa2222ae195930ea2..1d2eb6455b1381ec5386adf084dcd1daa344e85d 100644
--- a/scp/admin.inc.php
+++ b/scp/admin.inc.php
@@ -23,7 +23,9 @@ if(!$ost or !$thisstaff or !$thisstaff->isAdmin()){
 
 //Some security related warnings - bitch until fixed!!! :)
 if($ost->isUpgradePending()) {
-    $errors['err']=$sysnotice='System upgrade is pending <a href="../setup/upgrade.php">Upgrade Now</a>';
+    $errors['err']=$sysnotice='System upgrade is pending <a href="upgrade.php">Upgrade Now</a>';
+    require('upgrade.php');
+    exit;
 } else {
     
     if(file_exists('../setup/')) {
diff --git a/scp/profile.php b/scp/profile.php
index e6506fa6ece8bd0686550cae4810e17a2c76cd6f..96e1b7e29af59bb03fa929600a02c66c60fde4ff 100644
--- a/scp/profile.php
+++ b/scp/profile.php
@@ -19,8 +19,7 @@ $msg='';
 $staff=Staff::lookup($thisstaff->getId());
 if($_POST && $_POST['id']!=$thisstaff->getId()) { //Check dummy ID used on the form.
  $errors['err']='Internal Error. Action Denied';
-}
-if(!$errors && $_POST) { //Handle post
+} elseif(!$errors && $_POST) { //Handle post
 
     if(!$staff)
         $errors['err']='Unknown or invalid staff';
diff --git a/scp/staff.inc.php b/scp/staff.inc.php
index a8310f5edc6ef9bbddf9bf088095f98337746614..42bd65ca0a5f28fd4d377ba124c006c11fd23663 100644
--- a/scp/staff.inc.php
+++ b/scp/staff.inc.php
@@ -93,7 +93,9 @@ $msg=$warn=$sysnotice='';
 $tabs=array();
 $submenu=array();
 if($ost->isUpgradePending()) {
-    $errors['err']=$sysnotice='System upgrade is pending <a href="../setup/upgrade.php">Upgrade Now</a>';
+    $errors['err']=$sysnotice='System upgrade is pending <a href="upgrade.php">Upgrade Now</a>';
+    require('upgrade.php');
+    exit;
 } elseif($cfg->isHelpDeskOffline()) {
     $sysnotice='<strong>System is set to offline mode</strong> - Client interface is disabled and ONLY admins can access staff control panel.';
     $sysnotice.=' <a href="settings.php">Enable</a>.';
diff --git a/scp/upgrade.php b/scp/upgrade.php
index e5fd21084ccb534167d681ee6288793d5a683296..7a9c35b579c4aa5ae28b922c61187eb10a4eebc7 100644
--- a/scp/upgrade.php
+++ b/scp/upgrade.php
@@ -13,31 +13,12 @@
 
     vim: expandtab sw=4 ts=4 sts=4:
 **********************************************************************/
-function staffLoginPage($msg) {
-        
-    $_SESSION['_staff']['auth']['dest']=THISPAGE;
-    $_SESSION['_staff']['auth']['msg']=$msg;
-    header('Location: ../scp/login.php');
-    exit;
-}
-
-require '../scp/staff.inc.php';
-if(!$thisstaff or !$thisstaff->isAdmin()) {
-    staffLoginPage('Admin Access Required!');
-    exit;
-}
-
-define('SETUPINC', true);
-define('INC_DIR', './inc/');
-define('SQL_DIR', INC_DIR.'sql/');
-
-require_once INC_DIR.'class.upgrader.php';
+require_once 'admin.inc.php';
+require_once INCLUDE_DIR.'class.upgrader.php';
 
 //$_SESSION['ost_upgrader']=null;
-$upgrader = new Upgrader($cfg->getSchemaSignature(), TABLE_PREFIX, SQL_DIR);
-
+$upgrader = new Upgrader($cfg->getSchemaSignature(), TABLE_PREFIX, PATCH_DIR);
 
-$wizard=array();
 $wizard['title']='osTicket Upgrade Wizard';
 $wizard['tagline']='Upgrading osTicket to v'.$upgrader->getVersionVerbose();
 $wizard['logo']='logo-upgrade.png';
@@ -77,25 +58,32 @@ if($_POST && $_POST['s'] && !$upgrader->isAborted()) {
 
 switch(strtolower($upgrader->getState())) {
     case 'aborted':
-        $inc='upgrade-aborted.inc.php';
+        $inc='aborted.inc.php';
         break;
     case 'upgrade':
         $inc='upgrade.inc.php';
         break;
     case 'done':
-        $inc='upgrade-done.inc.php';
+        $inc='done.inc.php';
         break;
     default:
-        $inc='upgrade-prereq.inc.php';
+        $inc='upgrade.inc.php';
         if($upgrader->isAborted())
-            $inc='upgrade-aborted.inc.php';
+            $inc='aborted.inc.php';
         elseif(!$ost->isUpgradePending())
-            $errors['err']='Nothing to do! System already upgraded to the latest version';
+            $errors['err']='Nothing to do! System already upgraded to <b>'.$ost->getVersion().'</b> with no pending patches to apply.';
         elseif(!$upgrader->isUpgradable())
             $errors['err']='The upgrader does NOT support upgrading from the current vesion!';
 }
 
-require(INC_DIR.'header.inc.php');
-require(INC_DIR.$inc);
-require(INC_DIR.'footer.inc.php');
+$nav->setTabActive('dashboard');
+$nav->addSubMenu(array('desc'=>'Upgrader',
+                           'title'=>'Upgrader',
+                           'href'=>'upgrade.php',
+                           'iconclass'=>'preferences'),
+                        true);
+$ost->addExtraHeader('<script type="text/javascript" src="./js/upgrader.js"></script>');
+require(STAFFINC_DIR.'header.inc.php');
+require(UPGRADE_DIR.$inc);
+require(STAFFINC_DIR.'footer.inc.php');
 ?>