diff --git a/gnome/src/codeclist.c b/gnome/src/codeclist.c
index 77c548a31d470f28c2c6715c4e4f1f515d753d1f..9ac7dcd328c582805954c9c7af86db38e099edca 100644
--- a/gnome/src/codeclist.c
+++ b/gnome/src/codeclist.c
@@ -61,12 +61,11 @@ static codec_t *codec_create(gint payload, gchar **specs)
 
     codec->payload = payload;
     codec->name = g_strdup(specs[0]);
-    codec->bitrate = g_strdup(specs[1]);
-    codec->sample_rate = specs[2] ? atoi(specs[2]) : 0;
+    codec->sample_rate = specs[1] ? atoi(specs[1]) : 0;
+    codec->bitrate = g_strdup(specs[2]);
     codec->is_active = TRUE;
 
-    g_free(specs[2]);
-    g_free(specs);
+    g_strfreev(specs);
 
     return codec;
 }
@@ -207,7 +206,7 @@ void codec_set_active(codec_t *c, gboolean active)
 codec_t* codec_list_get_by_name(gconstpointer name, GQueue *q)
 {
     GList * c = g_queue_find_custom(q, name, is_name_codecstruct);
-    return c ? (codec_t *) c->data : NULL;
+    return c ? c->data : NULL;
 }
 
 codec_t* codec_list_get_by_payload(int payload, GQueue *q)
@@ -253,69 +252,59 @@ void codec_list_move_codec_down(guint codec_index, GQueue **q)
 
 }
 
-/* FIXME:tmatth: Clean this up, shouldn't have to do all the reallocs
- * explicitly if we use a nicer data structure */
-static void
-codec_list_update_to_daemon_audio(const account_t *acc)
+/* Returns a list of strings for just the active codecs in a given queue of codecs */
+static GSList*
+codec_list_get_active_codecs(GQueue *codecs, gboolean by_payload)
 {
-    guint c = 0;
-
-    gchar** codecList = NULL;
-    // Get all codecs in queue
-    for (guint i = 0; i < acc->acodecs->length; i++) {
-        codec_t* currentCodec = g_queue_peek_nth(acc->acodecs, i);
-
-        // Save only if active
+    GSList *active = NULL;
+    for (guint i = 0; i < codecs->length; i++) {
+        codec_t* currentCodec = g_queue_peek_nth(codecs, i);
         if (currentCodec && currentCodec->is_active) {
-            codecList = (void *) g_realloc(codecList, (c + 1) * sizeof(void *));
-            *(codecList + c) = g_strdup_printf("%d", currentCodec->payload);
-            c++;
+            if (by_payload)
+                active = g_slist_append(active, g_strdup_printf("%d", currentCodec->payload));
+            else
+                active = g_slist_append(active, g_strdup(currentCodec->name));
         }
     }
+    return active;
+}
 
-    // Allocate NULL array at the end for Dbus
-    codecList = (void *) g_realloc(codecList, (c + 1) * sizeof(void*));
-    *(codecList + c) = NULL;
-    c++;
+/* Given a singly linked list of codecs, returns a list of pointers
+ * to each element in the list's data. No duplication is done so
+ * the returned list is only valid for the lifetime of the GSList */
+static gchar **
+get_items_from_list(GSList *codecs)
+{
+    const guint length = g_slist_length(codecs);
+    /* we add +1 because the last element must be a NULL pointer for d-bus */
+    gchar **activeCodecsStr = g_new0(gchar*, length + 1);
+    for (guint i = 0; i < length; ++i)
+        activeCodecsStr[i] = g_slist_nth_data(codecs, i);
+    return activeCodecsStr;
+}
+
+static void
+codec_list_update_to_daemon_audio(const account_t *acc)
+{
+    GSList *activeCodecs = codec_list_get_active_codecs(acc->acodecs, TRUE);
+    gchar **activeCodecsStr = get_items_from_list(activeCodecs);
 
     // call dbus function with array of strings
-    dbus_set_active_audio_codec_list((const gchar**) codecList, acc->accountID);
-    // Delete memory
-    for (guint i = 0; i < c; i++)
-        g_free(*(codecList + i));
-    g_free(codecList);
+    dbus_set_active_audio_codec_list((const gchar **) activeCodecsStr, acc->accountID);
+    g_free(activeCodecsStr);
+    g_slist_free_full(activeCodecs, g_free);
 }
 
 #ifdef SFL_VIDEO
 static void codec_list_update_to_daemon_video(const account_t *acc)
 {
-    gchar** codecList = NULL;
-    // Get all codecs in queue
-    guint c = 0;
-    for (guint i = 0; i < acc->vcodecs->length; i++) {
-        codec_t* currentCodec = g_queue_peek_nth(acc->vcodecs, i);
-
-        // Save only if active
-        if (currentCodec && currentCodec->is_active) {
-            codecList = (void *) g_realloc(codecList, (c + 1) * sizeof(void *));
-            *(codecList + c) = g_strdup(currentCodec->name);
-            c++;
-        }
-    }
-
-    // Allocate NULL array at the end for Dbus
-    codecList = (void*) g_realloc(codecList, (c + 1) * sizeof (void*));
-    *(codecList + c) = NULL;
-    c++;
+    GSList *activeCodecs = codec_list_get_active_codecs(acc->vcodecs, FALSE);
+    gchar **activeCodecsStr = get_items_from_list(activeCodecs);
 
     // call dbus function with array of strings
-    dbus_set_active_video_codec_list((const gchar**) codecList, acc->accountID);
-
-    // Delete memory
-    for (guint i = 0; i < c; i++)
-        g_free(*(codecList + i));
-
-    g_free(codecList);
+    dbus_set_active_video_codec_list((const gchar **) activeCodecsStr, acc->accountID);
+    g_free(activeCodecsStr);
+    g_slist_free_full(activeCodecs, g_free);
 }
 #endif
 
diff --git a/gnome/src/config/accountconfigdialog.c b/gnome/src/config/accountconfigdialog.c
index 819fdc0764ba2420d576e5d8fd6c263423e9ca7c..57a07b3466f74c88d1e58a219f61b0e3a0ee9817 100644
--- a/gnome/src/config/accountconfigdialog.c
+++ b/gnome/src/config/accountconfigdialog.c
@@ -1338,7 +1338,7 @@ GtkWidget *show_account_window(const account_t *account)
     GtkWidget *audiocodecs_tab = create_audiocodecs_configuration(account);
     gtk_notebook_append_page(GTK_NOTEBOOK(notebook), audiocodecs_tab, gtk_label_new(_("Audio")));
     gtk_notebook_page_num(GTK_NOTEBOOK(notebook), audiocodecs_tab);
-    
+
 #ifdef SFL_VIDEO
     /* Video Codecs */
     GtkWidget *videocodecs_tab = create_videocodecs_configuration(account);
diff --git a/gnome/src/config/audioconf.c b/gnome/src/config/audioconf.c
index f5ded899579747f75006127803a6238ecab30ce4..142e2cddcab6a31f812d2ea160c1b39ae507264b 100644
--- a/gnome/src/config/audioconf.c
+++ b/gnome/src/config/audioconf.c
@@ -53,7 +53,7 @@ static GtkWidget *ringtone;
 static GtkWidget *plugin;
 static GtkWidget *codecMoveUpButton;
 static GtkWidget *codecMoveDownButton;
-static GtkWidget *codecTreeView;		// View used instead of store to get access to selection
+static GtkWidget *codecTreeView; // View used instead of store to get access to selection
 static GtkWidget *pulse;
 static GtkWidget *alsabox;
 static GtkWidget *alsa_conf;
@@ -67,6 +67,9 @@ enum {
     CODEC_COLUMN_COUNT
 };
 
+#define KBPS "kbps"
+#define KHZ "kHz"
+
 static void codec_move_up(GtkButton *button UNUSED, gpointer data);
 static void codec_move_down(GtkButton *button UNUSED, gpointer data);
 static void active_is_always_recording(void);
@@ -97,8 +100,8 @@ preferences_dialog_fill_codec_list(const account_t *account)
             DEBUG("%s is %sactive", c->name, c->is_active ? "" : "not ");
             GtkTreeIter iter;
             gtk_list_store_append(codecStore, &iter);
-            gchar *samplerate = g_strdup_printf("%d kHz", c->sample_rate);
-            gchar *bitrate = g_strdup_printf("%s kbps", c->bitrate);
+            gchar *samplerate = g_strdup_printf("%d " KHZ, (gint) (c->sample_rate * 0.001));
+            gchar *bitrate = g_strdup_printf("%s " KBPS, c->bitrate);
 
             gtk_list_store_set(codecStore, &iter,
                                COLUMN_CODEC_ACTIVE, c->is_active,
@@ -426,23 +429,28 @@ codec_active_toggled(GtkCellRendererToggle *renderer UNUSED, gchar *path, gpoint
     // Get active value and name at iteration
     gboolean active;
     gchar* name;
-    gchar* srate;
+    gchar* samplerate;
     gtk_tree_model_get(model, &iter, COLUMN_CODEC_ACTIVE, &active,
                        COLUMN_CODEC_NAME, &name, COLUMN_CODEC_FREQUENCY,
-                       &srate, -1);
+                       &samplerate, -1);
 
-    DEBUG("Selected Codec: %s, %s", name, srate);
+    DEBUG("Selected Codec: %s, %s", name, samplerate);
 
     codec_t* codec = NULL;
 
-    if (utf8_case_equal(name,"speex") && utf8_case_equal(srate, "8 kHz"))
-        codec = codec_list_get_by_payload(110, acc->acodecs);
-    else if (utf8_case_equal(name,"speex") && utf8_case_equal(srate,"16 kHz"))
-        codec = codec_list_get_by_payload(111, acc->acodecs);
-    else if (utf8_case_equal(name,"speex") && utf8_case_equal(srate, "32 kHz"))
-        codec = codec_list_get_by_payload(112, acc->acodecs);
-    else
+    const gboolean is_speex = utf8_case_equal(name, "speex");
+    if (is_speex) {
+        if (utf8_case_equal(samplerate, "8 " KHZ))
+            codec = codec_list_get_by_payload(110, acc->acodecs);
+        else if (utf8_case_equal(samplerate, "16 " KHZ))
+            codec = codec_list_get_by_payload(111, acc->acodecs);
+        else if (utf8_case_equal(samplerate, "32 " KHZ))
+            codec = codec_list_get_by_payload(112, acc->acodecs);
+        else
+            codec = codec_list_get_by_name((gconstpointer) name, acc->acodecs);
+    } else {
         codec = codec_list_get_by_name((gconstpointer) name, acc->acodecs);
+    }
 
     // Toggle active value
     active = !active;
diff --git a/gnome/src/config/videoconf.c b/gnome/src/config/videoconf.c
index 08fb740a259afa2057ed52e6c47a82722e7d0f9e..691395c93d7688250cee19d1637f032c8044ed95 100644
--- a/gnome/src/config/videoconf.c
+++ b/gnome/src/config/videoconf.c
@@ -185,7 +185,7 @@ static void preferences_dialog_fill_codec_list(account_t *a)
         codec_t *c = g_queue_peek_nth(list, i);
 
         if (c) {
-            g_print("%s", c->name);
+            DEBUG("%s", c->name);
             gtk_list_store_append(codecStore, &iter);
             gchar *bitrate = g_strdup_printf("%s kbps", c->bitrate);
 
@@ -226,8 +226,8 @@ codec_active_toggled(GtkCellRendererToggle *renderer UNUSED, gchar *path,
     gtk_tree_model_get(model, &iter, COLUMN_CODEC_ACTIVE, &active,
                        COLUMN_CODEC_NAME, &name, -1);
 
-    g_print("%s\n", name);
-    g_print("%i\n", g_queue_get_length (acc->vcodecs));
+    DEBUG("%s", name);
+    DEBUG("video codecs length %i", g_queue_get_length(acc->vcodecs));
 
     codec_t *codec = codec_list_get_by_name((gconstpointer) name, acc->vcodecs);
 
diff --git a/kde/src/CallView.cpp b/kde/src/CallView.cpp
index ed3ecd8a29937a0cb7330377891ef900aafd9894..e2af09fbd9a337c95cd98520dbcc2c4f1945eeb9 100644
--- a/kde/src/CallView.cpp
+++ b/kde/src/CallView.cpp
@@ -94,7 +94,7 @@ CallView::CallView(QWidget* parent) : QTreeWidget(parent),m_pActiveOverlay(0),m_
    setDragEnabled(true);
    setAnimated   (true);
    setUniformRowHeights(false);
-   
+
    CallTreeItemDelegate *delegate = new CallTreeItemDelegate(this);
    setItemDelegate(delegate);
    setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
@@ -106,7 +106,7 @@ CallView::CallView(QWidget* parent) : QTreeWidget(parent),m_pActiveOverlay(0),m_
    m_pTransferLE      = new KLineEdit       ( m_pTransferOverlay );
    QGridLayout* gl    = new QGridLayout     ( m_pTransferOverlay );
    QLabel* lblImg     = new QLabel          ( image              );
-   
+
    m_pTransferOverlay->setVisible(false);
    m_pTransferOverlay->resize(size());
    m_pTransferOverlay->setCornerWidget(lblImg);
@@ -114,7 +114,7 @@ CallView::CallView(QWidget* parent) : QTreeWidget(parent),m_pActiveOverlay(0),m_
 
    m_pTransferB->setText(i18n("Transfer"));
    m_pTransferB->setMaximumSize(70,9000);
-   
+
    gl->addItem  (new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Minimum), 0 , 0 , 1 , 3 );
    gl->addWidget(m_pTransferLE                                                   , 1 , 1 , 1 , 2 );
    gl->addWidget(m_pTransferB                                                    , 1 , 4 , 1 , 2 );
@@ -428,7 +428,7 @@ void CallView::transfer()
          SFLPhoneAccessibility::getInstance()->say(i18n("You call have been transferred to ")+m_pTransferLE->text());
       }
    }
-   
+
    m_pCallPendingTransfer = 0;
    m_pTransferLE->clear();
 
@@ -467,9 +467,9 @@ void CallView::hideOverlay()
       disconnect(m_pCallPendingTransfer,SIGNAL(changed()),this,SLOT(hideOverlay()));
       m_pActiveOverlay->setVisible(false);
    }
-   
+
    m_pActiveOverlay = 0;
-   
+
    m_pCallPendingTransfer = 0;
 } //hideOverlay
 
@@ -566,7 +566,7 @@ CallTreeItem* CallView::insertItem(QTreeWidgetItem* item, QTreeWidgetItem* paren
 {
    if (!dynamic_cast<QTreeWidgetItem*>(item) && SFLPhone::model()->getCall(item) && !dynamic_cast<QTreeWidgetItem*>(parent))
       return nullptr;
-   
+
    if (!item) {
       kDebug() << "This is not a valid call";
       return 0;
@@ -782,7 +782,7 @@ CallViewOverlay::CallViewOverlay(QWidget* parent) : QWidget(parent),m_pIcon(0),m
 
 CallViewOverlay::~CallViewOverlay()
 {
-   
+
 }
 
 ///Add a widget (usually an icon) in the corner
@@ -845,4 +845,4 @@ void CallViewOverlay::changeVisibility() {
 void CallViewOverlay::setAccessMessage(QString message)
 {
    m_accessMessage = message;
-}
\ No newline at end of file
+}
diff --git a/kde/src/CallView.h b/kde/src/CallView.h
index 4a4825cfa711c76aa3d4d09159d4308f71589f28..b485e176e104eb6681a1446e65ac8d263ec61be3 100644
--- a/kde/src/CallView.h
+++ b/kde/src/CallView.h
@@ -43,7 +43,7 @@ typedef CallModel<CallTreeItem*,QTreeWidgetItem*> TreeWidgetCallModel;
 ///@class CallViewOverlay Display overlay on top of the call tree
 class CallViewOverlay : public QWidget {
    Q_OBJECT
-   
+
 public:
    //Constructor
    CallViewOverlay(QWidget* parent);
@@ -74,7 +74,7 @@ private slots:
 class CallView : public QTreeWidget {
    Q_OBJECT
    friend class CallTreeItemDelegate;
-   
+
    public:
       CallView                    ( QWidget* parent = 0                                                               );
       ~CallView                   (                                                                                   );