diff --git a/assets/default/css/theme.css b/assets/default/css/theme.css
index 3f1cb699c0c6d477b45bec4a4e08b2626b75ade4..88c4898a80b62ae5be6ede550948a3e217fd3a8a 100644
--- a/assets/default/css/theme.css
+++ b/assets/default/css/theme.css
@@ -708,6 +708,13 @@ a.refresh {
   font-size: 12px;
   padding: 5px;
 }
+
+#ticketThread table th span {
+    font-weight:normal;
+    color:#888;
+    padding-left:20px;
+}
+
 #ticketThread table td {
   padding: 5px;
 }
diff --git a/include/class.config.php b/include/class.config.php
index e4183779f4db2da35eea349b252512df97af2baf..626e11c9a0e3eb466046f3539b9ed16ecb7c0c7e 100644
--- a/include/class.config.php
+++ b/include/class.config.php
@@ -168,6 +168,10 @@ class Config {
     function showRelatedTickets() {
         return $this->config['show_related_tickets'];
     }
+
+    function showNotesInline(){
+        return $this->config['show_notes_inline'];
+    }
         
     function getClientTimeout() {
         return $this->getClientSessionTimeout();
@@ -675,6 +679,7 @@ class Config {
              ',show_assigned_tickets='.db_input(isset($vars['show_assigned_tickets'])?1:0).
              ',show_answered_tickets='.db_input(isset($vars['show_answered_tickets'])?1:0).
              ',show_related_tickets='.db_input(isset($vars['show_related_tickets'])?1:0).
+             ',show_notes_inline='.db_input(isset($vars['show_notes_inline'])?1:0).
              ',hide_staff_name='.db_input(isset($vars['hide_staff_name'])?1:0);
 
         return (db_query($sql));
diff --git a/include/class.ticket.php b/include/class.ticket.php
index ffee446b17e0c300ee0d15bcf406a010f7dfdb46..6a27d981bb24bdc7f05a6c8adec30615f0f7ed24 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -527,68 +527,67 @@ class Ticket{
         return $this->ht['notes'];
     }
 
-    function getNotes($order='') {
+    function getMessages() {
+        return $this->getThreadByType('M');
+    }
 
-        if(!$order || !in_array($order, array('DESC','ASC')))
-            $order='DESC';
-
-        $sql ='SELECT note.*, count(DISTINCT attach.attach_id) as attachments '
-            .' FROM '.TICKET_THREAD_TABLE.' note '
-            .' LEFT JOIN '.TICKET_ATTACHMENT_TABLE.' attach
-                ON (note.ticket_id=attach.ticket_id AND note.id=attach.ref_id AND ref_type="N") '
-            .' WHERE note.ticket_id='.db_input($this->getId())
-            .'   AND note.thread_type="N"'
-            .' GROUP BY note.id '
-            .' ORDER BY note.created '.$order;
-
-        $notes=array();
-        if(($res=db_query($sql)) && db_num_rows($res))
-            while($rec=db_fetch_array($res))
-                $notes[]=$rec;
+    function getResponses($msgId=0) {
+        return $this->getThreadByType('R', $msgID);
+    }
 
-        return $notes;
+    function getNotes() {
+        return $this->getThreadByType('N');
     }
 
-    function getMessages() {
+    function getClientThread() {
+        return $this->getThreadwithoutNotes();
+    }
 
-        $sql='SELECT msg.id, msg.created, msg.body '
-            .' ,count(DISTINCT attach.attach_id) as attachments '
-            .' ,count( DISTINCT resp.id) as responses '
-            .' FROM '.TICKET_THREAD_TABLE.' msg '
-            .' LEFT JOIN '.TICKET_THREAD_TABLE.' resp ON ('
-                .'resp.pid=msg.id AND resp.thread_type = "R") '
-            .' LEFT JOIN '.TICKET_ATTACHMENT_TABLE.' attach '
-                .'ON (msg.ticket_id=attach.ticket_id AND msg.id=attach.ref_id AND ref_type="M") '
-            .' WHERE  msg.ticket_id='.db_input($this->getId())
-               .' AND msg.thread_type="M"'
-            .' GROUP BY msg.id '
-            .' ORDER BY msg.created ASC ';
-
-        $messages=array();
-        if(($res=db_query($sql)) && db_num_rows($res))
-            while($rec=db_fetch_array($res))
-                $messages[] = $rec;
-                
-        return $messages;
+    function getThreadWithNotes() {
+        return $this->getThread(true);
+    }
+    
+    function getThreadWithoutNotes() {
+        return $this->getThread(false);
     }
 
-    function getResponses($msgId) {
+    function getThread($includeNotes=false, $order='') {
 
-        $sql='SELECT resp.*, count(DISTINCT attach.attach_id) as attachments '
-            .' FROM '.TICKET_THREAD_TABLE. ' resp '
+        $treadtypes=array('M', 'R'); // messages and responses.
+        if($includeNotes) //Include notes??
+            $treadtypes[] = 'N';
+
+        return $this->getThreadbyType($treadtypes, $order);
+    }
+        
+    function getThreadByType($type, $order='ASC') {
+
+        if(!$order || !in_array($order, array('DESC','ASC')))
+            $order='ASC';
+
+        $sql='SELECT thread.* '
+            .' ,count(DISTINCT attach.attach_id) as attachments '
+            .' FROM '.TICKET_THREAD_TABLE.' thread '
             .' LEFT JOIN '.TICKET_ATTACHMENT_TABLE.' attach 
-                ON (resp.ticket_id=attach.ticket_id AND resp.id=attach.ref_id AND ref_type="R") '
-            .' WHERE  resp.ticket_id='.db_input($this->getId())
-            .'   AND  resp.thread_type="R"'
-            .' GROUP BY resp.id '
-            .' ORDER BY resp.created';
+                ON (thread.ticket_id=attach.ticket_id 
+                        AND thread.id=attach.ref_id 
+                        AND thread.thread_type=attach.ref_type) '
+            .' WHERE  thread.ticket_id='.db_input($this->getId());
 
-        $responses=array();
+        if($type && is_array($type))
+            $sql.=" AND thread.thread_type IN('".implode("','", $type)."')";
+        else
+            $sql.=' AND thread.thread_type='.db_input($type);
+
+        $sql.=' GROUP BY thread.id '
+             .' ORDER BY thread.created '.$order;
+
+        $thread=array();
         if(($res=db_query($sql)) && db_num_rows($res))
-            while($rec= db_fetch_array($res))
-                $responses[] = $rec;
-                
-        return $responses;
+            while($rec=db_fetch_array($res))
+                $thread[] = $rec;
+
+        return $thread;
     }
 
     function getAttachments($refId=0, $type=null) {
diff --git a/include/client/view.inc.php b/include/client/view.inc.php
index f67e6d94bd3a4456e30b17797254dff49204b960..debddc4ed4713aeb3dec50b48e1fcb5bfe2f9ccc 100644
--- a/include/client/view.inc.php
+++ b/include/client/view.inc.php
@@ -59,46 +59,25 @@ if(!$dept || !$dept->isPublic())
 <span class="Icon thread">Ticket Thread</span>
 <div id="ticketThread">
 <?php    
-if($ticket->getThreadCount() && ($messages = $ticket->getMessages())) {
-     
-    foreach($messages as $message) {?>
-    
-        <table class="message" cellspacing="0" cellpadding="1" width="800" border="0">
-        
-            <tr><th><?php echo Format::db_datetime($message['created']); ?></th></tr>
-            
-            <tr><td><?php echo Format::display($message['body']); ?></td></tr>
-            
+if($ticket->getThreadCount() && ($thread=$ticket->getClientThread())) {
+    $threadType=array('M' => 'message', 'R' => 'response');
+    foreach($thread as $entry) {
+        //Making sure internal notes are not displayed due to backend MISTAKES!
+        if(!$threadType[$entry['thread_type']]) continue;
+        $poster = $entry['poster'];
+        if($entry['thread_type']=='R' && $cfg->hideStaffName())
+            $poster = ' ';
+        ?>
+        <table class="<?php echo $threadType[$entry['thread_type']]; ?>" cellspacing="0" cellpadding="1" width="800" border="0">
+            <tr><th><?php echo Format::db_datetime($entry['created']); ?> &nbsp;&nbsp;<span><?php echo $poster; ?></span></th></tr>
+            <tr><td><?php echo Format::display($entry['body']); ?></td></tr>
             <?php
-            
-            if($message['attachments'] && ($links=$ticket->getAttachmentsLinks($message['id'],'M'))) { ?>
-            
+            if($entry['attachments'] && ($links=$ticket->getAttachmentsLinks($entry['id'], $entry['thread_type']))) { ?>
                 <tr><td class="info"><?php echo $links; ?></td></tr>
-                
             <?php
-            
             } ?>
-            
         </table>
-        <?php
-        if($message['responses'] && ($responses=$ticket->getResponses($message['id']))) {
-           foreach($responses as $resp) {
-               $staff=$cfg->hideStaffName()?'staff':Format::htmlchars($resp['staff_name']);
-               ?>
-               <table class="response" cellspacing="0" cellpadding="1" width="100%" border="0">
-                <tr>
-                    <th><?php echo Format::db_datetime($resp['created']);?>&nbsp;-&nbsp;<?php echo $staff; ?></th>
-                </tr>
-                <tr><td><?php echo Format::display($resp['body']); ?></td></tr>
-                <?php
-                if($resp['attachments'] && ($links=$ticket->getAttachmentsLinks($resp['id'],'R'))) {?>
-                 <tr><td class="info"><?php echo $links; ?></td></tr>
-                <?php
-                 }?>
-                </table>
-            <?
-           }
-       }
+    <?php
     }
 }
 ?>
diff --git a/include/staff/settings-tickets.inc.php b/include/staff/settings-tickets.inc.php
index bcf7347a74cf6d5bf5e9c60cfbe1b28729bbaffd..5ada80f48bca4edfb7221e6916aa5e46efb85d94 100644
--- a/include/staff/settings-tickets.inc.php
+++ b/include/staff/settings-tickets.inc.php
@@ -1,140 +1,148 @@
-<form action="settings.php?t=tickets" method="post" id="save">
-<input type="hidden" name="t" value="tickets" >
-<table class="form_table settings_table" width="940" border="0" cellspacing="0" cellpadding="2">
-    <thead>
-        <tr>
-            <th colspan="2">
-                <h4>Ticket Settings and Options</h4>
-                <em>Global ticket settings and options.</em>
-            </th>
-        </tr>
-    </thead>
-    <tbody>
-        <tr><td width="220" class="required">Ticket IDs:</td>
-            <td>
-                <input type="radio" name="random_ticket_ids"  value="0" <?php echo !$config['random_ticket_ids']?'checked="checked"':''; ?> />
-                Sequential
-                <input type="radio" name="random_ticket_ids"  value="1" <?php echo $config['random_ticket_ids']?'checked="checked"':''; ?> />
-                Random  <em>(highly recommended)</em>
-            </td>
-        </tr>
-
-        <tr>
-            <td width="180" class="required">
-                Default SLA:
-            </td>
-            <td>
-                <select name="default_sla_id">
-                    <option value="0">&mdash; None &mdash;</option>
-                    <?php
-                    $sql='SELECT id,name FROM '.SLA_TABLE.' sla ORDER by name';
-                    if(($res=db_query($sql)) && db_num_rows($res)){
-                        while(list($id,$name)=db_fetch_row($res)){
-                            $selected=($config['default_sla_id'] && $id==$config['default_sla_id'])?'selected="selected"':'';
-                            echo sprintf('<option value="%d" %s>%s</option>',$id,$selected,$name);
-                        }
-                    }
-                    ?>
-                </select>
-                &nbsp;<span class="error">*&nbsp;<?php echo $errors['default_sla_id']; ?></span>
-            </td>
-        </tr>
-        <tr>
-            <td width="180" class="required">Default Priority:</td>
-            <td>
-                <select name="default_priority_id">
+<form action="settings.php?t=tickets" method="post" id="save">
+<input type="hidden" name="t" value="tickets" >
+<table class="form_table settings_table" width="940" border="0" cellspacing="0" cellpadding="2">
+    <thead>
+        <tr>
+            <th colspan="2">
+                <h4>Ticket Settings and Options</h4>
+                <em>Global ticket settings and options.</em>
+            </th>
+        </tr>
+    </thead>
+    <tbody>
+        <tr><td width="220" class="required">Ticket IDs:</td>
+            <td>
+                <input type="radio" name="random_ticket_ids"  value="0" <?php echo !$config['random_ticket_ids']?'checked="checked"':''; ?> />
+                Sequential
+                <input type="radio" name="random_ticket_ids"  value="1" <?php echo $config['random_ticket_ids']?'checked="checked"':''; ?> />
+                Random  <em>(highly recommended)</em>
+            </td>
+        </tr>
+
+        <tr>
+            <td width="180" class="required">
+                Default SLA:
+            </td>
+            <td>
+                <select name="default_sla_id">
+                    <option value="0">&mdash; None &mdash;</option>
                     <?php
-                    $priorities= db_query('SELECT priority_id,priority_desc FROM '.TICKET_PRIORITY_TABLE);
-                    while (list($id,$tag) = db_fetch_row($priorities)){ ?>
-                        <option value="<?php echo $id; ?>"<?php echo ($config['default_priority_id']==$id)?'selected':''; ?>><?php echo $tag; ?></option>
+                    $sql='SELECT id,name FROM '.SLA_TABLE.' sla ORDER by name';
+                    if(($res=db_query($sql)) && db_num_rows($res)){
+                        while(list($id,$name)=db_fetch_row($res)){
+                            $selected=($config['default_sla_id'] && $id==$config['default_sla_id'])?'selected="selected"':'';
+                            echo sprintf('<option value="%d" %s>%s</option>',$id,$selected,$name);
+                        }
+                    }
+                    ?>
+                </select>
+                &nbsp;<span class="error">*&nbsp;<?php echo $errors['default_sla_id']; ?></span>
+            </td>
+        </tr>
+        <tr>
+            <td width="180" class="required">Default Priority:</td>
+            <td>
+                <select name="default_priority_id">
                     <?php
-                    } ?>
-                </select>
-                &nbsp;<span class="error">*&nbsp;<?php echo $errors['default_priority_id']; ?></span>
-             </td>
-        </tr>
-        <tr>
-            <td width="180">Web Tickets Priority</td>
-            <td>
-                <input type="checkbox" name="allow_priority_change" value="1" <?php echo $config['allow_priority_change'] ?'checked="checked"':''; ?>>
-                <em>(Allow user to overwrite/set priority)</em>
-            </td>
-        </tr>
-        <tr>
-            <td width="180">Emailed Tickets Priority</td>
-            <td>
-                <input type="checkbox" name="use_email_priority" value="1" <?php echo $config['use_email_priority'] ?'checked="checked"':''; ?> >
-                <em>(Use email priority when available)</em>
-            </td>
-        </tr>
-        <tr>
-            <td width="180">Show Related Tickets</td>
-            <td>
-                <input type="checkbox" name="show_related_tickets" value="1" <?php echo $config['show_related_tickets'] ?'checked="checked"':''; ?> >
-                <em>(Show all related tickets on user login - otherwise access is restricted to one ticket view per login)</em>
-            </td>
-        </tr>
-        <tr>
-            <td>Human Verification:</td>
-            <td>
-                <input type="checkbox" name="enable_captcha" <?php echo $config['enable_captcha']?'checked="checked"':''; ?>>
-                Enable CAPTCHA on new web tickets.<em>(requires GDLib)</em> &nbsp;<font class="error">&nbsp;<?php echo $errors['enable_captcha']; ?></font><br/>
-            </td>
-        </tr>
-        <tr>
-            <td>Maximum <b>Open</b> Tickets:</td>
-            <td>
-                <input type="text" name="max_open_tickets" size=4 value="<?php echo $config['max_open_tickets']; ?>">
-                per email/user. <em>(Helps with spam and email flood control - enter 0 for unlimited)</em>
-            </td>
-        </tr>
-        <tr>
-            <td>Ticket Auto-lock Time:</td>
-            <td>
-                <input type="text" name="autolock_minutes" size=4 value="<?php echo $config['autolock_minutes']; ?>">
-                <font class="error"><?php echo $errors['autolock_minutes']; ?></font>
-                <em>(Minutes to lock a ticket on activity - enter 0 to disable locking)</em>
-            </td>
-        </tr>
-        <tr>
-            <td>Reopened Tickets:</td>
-            <td>
-                <input type="checkbox" name="auto_assign_reopened_tickets" <?php echo $config['auto_assign_reopened_tickets']?'checked="checked"':''; ?>>
-                Auto-assign reopened tickets to the last available respondent.
-            </td>
-        </tr>
-        <tr>
-            <td>Assigned Tickets:</td>
-            <td>
-                <input type="checkbox" name="show_assigned_tickets" <?php echo $config['show_assigned_tickets']?'checked="checked"':''; ?>>
-                Show assigned tickets on open queue.
-            </td>
-        </tr>
-        <tr>
-            <td>Answered Tickets:</td>
-            <td>
-                <input type="checkbox" name="show_answered_tickets" <?php echo $config['show_answered_tickets']?'checked="checked"':''; ?>>
-                Show answered tickets on open queue.
-            </td>
-        </tr>
-        <tr>
-            <td>Ticket Activity Log:</td>
-            <td>
-                <input type="checkbox" name="log_ticket_activity" <?php echo $config['log_ticket_activity']?'checked="checked"':''; ?>>
-                Log ticket activity as internal notes.
-            </td>
-        </tr>
-        <tr>
-            <td>Staff Identity Masking:</td>
-            <td>
-                <input type="checkbox" name="hide_staff_name" <?php echo $config['hide_staff_name']?'checked="checked"':''; ?>>
-                Hide staff's name on responses.
-            </td>
-        </tr>
-    </tbody>
-</table>
-<p style="padding-left:250px;">
-    <input class="button" type="submit" name="submit" value="Save Changes">
-    <input class="button" type="reset" name="reset" value="Reset Changes">
-</p>
-</form>
+                    $priorities= db_query('SELECT priority_id,priority_desc FROM '.TICKET_PRIORITY_TABLE);
+                    while (list($id,$tag) = db_fetch_row($priorities)){ ?>
+                        <option value="<?php echo $id; ?>"<?php echo ($config['default_priority_id']==$id)?'selected':''; ?>><?php echo $tag; ?></option>
+                    <?php
+                    } ?>
+                </select>
+                &nbsp;<span class="error">*&nbsp;<?php echo $errors['default_priority_id']; ?></span>
+             </td>
+        </tr>
+        <tr>
+            <td width="180">Web Tickets Priority</td>
+            <td>
+                <input type="checkbox" name="allow_priority_change" value="1" <?php echo $config['allow_priority_change'] ?'checked="checked"':''; ?>>
+                <em>(Allow user to overwrite/set priority)</em>
+            </td>
+        </tr>
+        <tr>
+            <td width="180">Emailed Tickets Priority</td>
+            <td>
+                <input type="checkbox" name="use_email_priority" value="1" <?php echo $config['use_email_priority'] ?'checked="checked"':''; ?> >
+                <em>(Use email priority when available)</em>
+            </td>
+        </tr>
+        <tr>
+            <td width="180">Show Related Tickets</td>
+            <td>
+                <input type="checkbox" name="show_related_tickets" value="1" <?php echo $config['show_related_tickets'] ?'checked="checked"':''; ?> >
+                <em>(Show all related tickets on user login - otherwise access is restricted to one ticket view per login)</em>
+            </td>
+        </tr>        
+        <tr>
+            <td width="180">Show Notes Inline</td>
+            <td>
+                <input type="checkbox" name="show_notes_inline" value="1" <?php echo $config['show_notes_inline'] ?'checked="checked"':''; ?> >
+                <em>(Show internal notes  inline)</em>
+              </td>
+        </tr>  
+        <tr>
+            <td>Human Verification:</td>
+            <td>
+                <input type="checkbox" name="enable_captcha" <?php echo $config['enable_captcha']?'checked="checked"':''; ?>>
+                Enable CAPTCHA on new web tickets.<em>(requires GDLib)</em> &nbsp;<font class="error">&nbsp;<?php echo $errors['enable_captcha']; ?></font><br/>
+            </td>
+        </tr>
+        <tr>
+            <td>Maximum <b>Open</b> Tickets:</td>
+            <td>
+                <input type="text" name="max_open_tickets" size=4 value="<?php echo $config['max_open_tickets']; ?>">
+                per email/user. <em>(Helps with spam and email flood control - enter 0 for unlimited)</em>
+            </td>
+        </tr>
+        <tr>
+            <td>Ticket Auto-lock Time:</td>
+            <td>
+                <input type="text" name="autolock_minutes" size=4 value="<?php echo $config['autolock_minutes']; ?>">
+                <font class="error"><?php echo $errors['autolock_minutes']; ?></font>
+                <em>(Minutes to lock a ticket on activity - enter 0 to disable locking)</em>
+            </td>
+        </tr>
+        <tr>
+            <td>Reopened Tickets:</td>
+            <td>
+                <input type="checkbox" name="auto_assign_reopened_tickets" <?php echo $config['auto_assign_reopened_tickets']?'checked="checked"':''; ?>>
+                Auto-assign reopened tickets to the last available respondent.
+            </td>
+        </tr>
+        <tr>
+            <td>Assigned Tickets:</td>
+            <td>
+                <input type="checkbox" name="show_assigned_tickets" <?php echo $config['show_assigned_tickets']?'checked="checked"':''; ?>>
+                Show assigned tickets on open queue.
+            </td>
+        </tr>
+        <tr>
+            <td>Answered Tickets:</td>
+            <td>
+                <input type="checkbox" name="show_answered_tickets" <?php echo $config['show_answered_tickets']?'checked="checked"':''; ?>>
+                Show answered tickets on open queue.
+            </td>
+        </tr>
+        <tr>
+            <td>Ticket Activity Log:</td>
+            <td>
+                <input type="checkbox" name="log_ticket_activity" <?php echo $config['log_ticket_activity']?'checked="checked"':''; ?>>
+                Log ticket activity as internal notes.
+            </td>
+        </tr>
+        <tr>
+            <td>Staff Identity Masking:</td>
+            <td>
+                <input type="checkbox" name="hide_staff_name" <?php echo $config['hide_staff_name']?'checked="checked"':''; ?>>
+                Hide staff's name on responses.
+            </td>
+        </tr>
+    </tbody>
+</table>
+<p style="padding-left:250px;">
+    <input class="button" type="submit" name="submit" value="Save Changes">
+    <input class="button" type="reset" name="reset" value="Reset Changes">
+</p>
+</form>
+
diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php
index faac0f86ef791a8726c266a8121a980860ddc267..ff46ace13e8c13f37e51317429409d3244f9932b 100644
--- a/include/staff/ticket-view.inc.php
+++ b/include/staff/ticket-view.inc.php
@@ -171,11 +171,21 @@ if($ticket->isOverdue())
     </tr>
 </table>
 <div class="clear" style="padding-bottom:10px;"></div>
+<?php
+$tcount = $ticket->getThreadCount();
+if($cfg->showNotesInline())
+    $tcount+= $ticket->getNumNotes();
+?>
 <ul id="threads">
-    <li><a class="active" id="toggle_ticket_thread" href="#">Ticket Thread (<?php echo $ticket->getThreadCount(); ?>)</a></li>
+    <li><a class="active" id="toggle_ticket_thread" href="#">Ticket Thread (<?php echo $tcount; ?>)</a></li>
+    <?php
+    if(!$cfg->showNotesInline()) {?>
     <li><a id="toggle_notes" href="#">Internal Notes (<?php echo $ticket->getNumNotes(); ?>)</a></li>
+    <?php
+    }?>
 </ul>
-
+<?php    
+if(!$cfg->showNotesInline()) { ?>
 <div id="ticket_notes">
     <?php
     /* Internal Notes */
@@ -189,14 +199,14 @@ if($ticket->isOverdue())
                     <?php
                     echo sprintf('%s <em>posted by <b>%s</b></em>',
                             Format::htmlchars($note['title']),
-                            Format::htmlchars($note['source']));
+                            Format::htmlchars($note['poster']));
                     ?>
                 </th>
                 <th class="date" width="300"><?php echo Format::db_datetime($note['created']); ?></th>
             </tr>
             <tr>
                 <td colspan="2">
-                    <?php echo Format::htmlchars($note['body']); ?>
+                    <?php echo Format::display($note['body']); ?>
                 </td>
             </tr>
             <?php
@@ -213,45 +223,32 @@ if($ticket->isOverdue())
         echo "<p>No internal notes found.</p>";
     }?>
 </div>
+<?php
+} ?>
 <div id="ticket_thread">
     <?php
-    /* -------- Messages & Responses -------------*/
-    if($ticket->getThreadCount() && ($messages = $ticket->getMessages())) {
-       foreach($messages as $message) {?>
-        <table class="message" cellspacing="0" cellpadding="1" width="940" border="0">
-            <tr><th><?php echo Format::db_datetime($message['created']); ?></th></tr>
-            <tr><td><?php echo Format::display($message['body']); ?></td></tr>
+    $threadTypes=array('M'=>'message','R'=>'response', 'N'=>'note');
+    /* -------- Messages & Responses & Notes (if inline)-------------*/
+    if(($thread=$ticket->getThread($cfg->showNotesInline()))) {
+       foreach($thread as $entry) {
+           ?>
+        <table class="<?php echo $threadTypes[$entry['thread_type']]; ?>" cellspacing="0" cellpadding="1" width="940" border="0">
+            <tr><th width="640"><?php echo Format::db_datetime($entry['created']);?>
+                    &nbsp;&nbsp;<span><?php echo Format::htmlchars($entry['title']); ?></span>
+                </th>
+                <th width="300" class="tmeta"><?php echo Format::htmlchars($entry['poster']); ?></th></tr>
+            <tr><td colspan=2><?php echo Format::display($entry['body']); ?></td></tr>
             <?php
-            if($message['attachments'] && ($links=$ticket->getAttachmentsLinks($message['id'],'M'))) {?>
+            if($entry['attachments'] && ($links=$ticket->getAttachmentsLinks($entry['id'], $entry['thread_type']))) {?>
             <tr>
-                <td class="info"><?php echo $links; ?></td>
+                <td class="info" colspan=2><?php echo $links; ?></td>
             </tr>
             <?php
             }?>
         </table>
         <?php
-        /* --------- Responses ------------ */
-        if($message['responses'] && ($responses=$ticket->getResponses($message['id']))) {
-           foreach($responses as $resp) {?>
-            <table class="response" cellspacing="0" cellpadding="1" width="100%" border="0">
-                <tr>
-                    <th><?php echo Format::db_datetime($resp['created']); ?>&nbsp;-&nbsp;<?php echo Format::htmlchars($resp['staff_name']); ?></th>
-                </tr>
-                <tr>
-                    <td><?php echo Format::display($resp['body']); ?></td>
-                </tr>
-                <?php
-                if($resp['attachments'] && ($links=$ticket->getAttachmentsLinks($resp['id'],'R'))) {?>
-                <tr>
-                    <td class="info"><?php echo $links; ?></td>
-                </tr>
-                <?php
-                }?>
-            </table>
-            <?php
-           }
-        }
-        $msgId=$message['id'];
+        if($entry['thread_type']=='M')
+            $msgId=$entry['id'];
        }
     } else {
         echo '<p>Error fetching ticket thread - get technical help.</p>';
diff --git a/main.inc.php b/main.inc.php
index fa1ca5da9c0745487af603b49fbcde740c09c61f..0bfcf903a91866cd9c046f3d90020e3539cd935a 100644
--- a/main.inc.php
+++ b/main.inc.php
@@ -55,7 +55,7 @@
 
     #Current version && schema signature (Changes from version to version)
     define('THIS_VERSION','1.7-DPR3'); //Shown on admin panel
-    define('SCHEMA_SIGNATURE','49478749dc680eef08b7954bd568cfd1'); //MD5 signature of the db schema. (used to trigger upgrades)
+    define('SCHEMA_SIGNATURE','c2d2fabfdf15e1632f00850ffb361558'); //MD5 signature of the db schema. (used to trigger upgrades)
 
     #load config info
     $configfile='';
diff --git a/scp/css/scp.css b/scp/css/scp.css
index c5eb222ba8bb06f9111b068fffb23cd7a9cb17c3..1964dfe80c2973eb845623b966c752cc78d9f6f5 100644
--- a/scp/css/scp.css
+++ b/scp/css/scp.css
@@ -689,41 +689,6 @@ h2 .reload {
     background:url(../images/icons/note.gif) 10px 50% no-repeat;
 }
 
-#latest_notes {
-    margin:10px 0;
-    padding:10px;
-    background:#ffe;
-    border:1px solid #e7e765;
-}
-
-#latest_notes h3 {
-    margin:0 0 10px 0;
-    padding:0;
-    font-size:11pt;
-}
-
-#latest_notes h3 span, #latest_notes h3 a {
-    color:#777;
-    font-weight:normal;
-    text-decoration:none;
-    font-size:10pt;
-}
-
-#latest_notes ul {
-    margin:0 20px;
-    padding:0;
-}
-
-#latest_notes ul li {
-    margin:0;
-    padding:0 0 10px 0;
-    list-style:none;
-}
-
-#latest_notes em {
-    color:#777;
-}
-
 #ticket_thread table {
     margin-top:10px;
     border:1px solid #aaa;
@@ -757,21 +722,40 @@ h2 .reload {
     color:#666;
 }
 
-#ticket_thread .message th {
-    background:#C3D9FF;
+#ticket_notes .date {
+    font-weight:normal;
+    font-size:10pt;
+    color:#888;
+    text-align:right;
 }
 
-#ticket_notes .date {
+#ticket_thread table th.tmeta {
     font-weight:normal;
     font-size:10pt;
     color:#888;
     text-align:right;
+    padding-right:15px;
+}
+
+#ticket_thread table th span {
+    font-weight:normal;
+    font-size:10pt;
+    color:#888;
+    padding-left:15px;
+}
+
+#ticket_thread .message th {
+    background:#C3D9FF;
 }
 
 #ticket_thread .response th {
     background:#FFE0B3;
 }
 
+#ticket_thread .note th {
+    background:#FFE;
+}
+
 #ticket_thread table td, #ticket_notes table td {
     padding:5px;
 }
diff --git a/scp/js/ticket.js b/scp/js/ticket.js
index f981bae070194dd478454edb5f308c341ce015cd..22a97d623bd34d0ef664b012c1cd040e9f55c15e 100644
--- a/scp/js/ticket.js
+++ b/scp/js/ticket.js
@@ -264,7 +264,7 @@ jQuery(function($) {
     if(location.hash != "" && $('#response_options '+location.hash).length) {
         $('#response_options '+location.hash+'_tab').addClass('active');
         $('#response_options '+location.hash).show();
-    } else if(location.hash == "#notes") {
+    } else if(location.hash == "#notes" && $('#ticket_notes').length) {
         $('#response_options #note_tab').addClass('active');
         $('#response_options form').hide();
         $('#response_options #note').show();
diff --git a/setup/inc/sql/49478749-c2d2fabf.patch.sql b/setup/inc/sql/49478749-c2d2fabf.patch.sql
new file mode 100644
index 0000000000000000000000000000000000000000..506d85572be1438a2734627f447e04f8616d6285
--- /dev/null
+++ b/setup/inc/sql/49478749-c2d2fabf.patch.sql
@@ -0,0 +1,2 @@
+ALTER TABLE  `%TABLE_PREFIX%config` CHANGE  `show_answered_tickets`  `show_answered_tickets` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT  '0';
+ALTER TABLE  `%TABLE_PREFIX%config` ADD  `show_notes_inline` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT  '1' AFTER  `show_answered_tickets`;
diff --git a/setup/inc/sql/osticket-v1.7-mysql.sql b/setup/inc/sql/osticket-v1.7-mysql.sql
index 33b034c763f8197e6d21d267abe50c58d2a37738..a3d03dd7218066d54ee3b900fba1fad9129add9a 100644
--- a/setup/inc/sql/osticket-v1.7-mysql.sql
+++ b/setup/inc/sql/osticket-v1.7-mysql.sql
@@ -134,7 +134,8 @@ CREATE TABLE `%TABLE_PREFIX%config` (
   `auto_assign_reopened_tickets` tinyint(1) unsigned NOT NULL default '1',
   `show_related_tickets` tinyint(1) unsigned NOT NULL default '1',
   `show_assigned_tickets` tinyint(1) unsigned NOT NULL default '0',
-  `show_answered_tickets` tinyint(1) NOT NULL default '0',
+  `show_answered_tickets` tinyint(1) unsigned NOT NULL default '0',
+  `show_notes_inline` tinyint(1) unsigned NOT NULL default '1',
   `hide_staff_name` tinyint(1) unsigned NOT NULL default '0',
   `overlimit_notice_active` tinyint(1) unsigned NOT NULL default '0',
   `email_attachments` tinyint(1) unsigned NOT NULL default '1',
diff --git a/setup/inc/sql/osticket-v1.7-mysql.sql.md5 b/setup/inc/sql/osticket-v1.7-mysql.sql.md5
index f27a74d5b65a34a55b6b03a5a5624c2adcf7fccf..798a76acc57bcf65d56d7c11af8cda14317aefea 100644
--- a/setup/inc/sql/osticket-v1.7-mysql.sql.md5
+++ b/setup/inc/sql/osticket-v1.7-mysql.sql.md5
@@ -1 +1 @@
-49478749dc680eef08b7954bd568cfd1
+c2d2fabfdf15e1632f00850ffb361558
diff --git a/tickets.php b/tickets.php
index d4759ba522e328911d2e9a494254ce338ea7f905..81b8ed68f153b551c4b063d2fa6860ea84070ac1 100644
--- a/tickets.php
+++ b/tickets.php
@@ -52,7 +52,7 @@ if($_POST && is_object($ticket) && $ticket->getId()):
             }
         }
                     
-        if(!$errors){
+        if(!$errors) {
             //Everything checked out...do the magic.
             if(($msgid=$ticket->postMessage($_POST['message'],'Web'))) {
                 if($files && $cfg->allowOnlineAttachments())
@@ -64,9 +64,7 @@ if($_POST && is_object($ticket) && $ticket->getId()):
             }
 
         } elseif(!$errors['err']) {
-            print_r($errors);
             $errors['err']='Error(s) occurred. Please try again';
-           
         }
         break;
     default: