diff --git a/CMakeLists.txt b/CMakeLists.txt
index dde6bce80204acf575317b9616719b6a137bfeb5..09c5b219545df9e955e983bf11516a7ee8989400 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -243,6 +243,7 @@ SET(libringclient_visitors_LIB_HDRS
 
 SET( libringclient_extra_LIB_HDRS
   src/typedefs.h
+  src/typedefs.hpp
 )
 
 # Include the headers for linking directly with libDring (used on platforms
diff --git a/src/call.cpp b/src/call.cpp
index aac4659039aa8c85e88fc6b9dd3f53d18003e421..e6f4631cd6044cbecc0885e37861fadcfacef3d7 100644
--- a/src/call.cpp
+++ b/src/call.cpp
@@ -207,7 +207,7 @@ QDebug LIB_EXPORT operator<<(QDebug dbg, const Call::Action& c)
          dbg.nospace() << "HOLD";
       case Call::Action::RECORD:
          dbg.nospace() << "RECORD";
-      case Call::Action::__COUNT:
+      case Call::Action::COUNT__:
          dbg.nospace() << "COUNT";
    };
    dbg.space();
@@ -584,7 +584,7 @@ const QString Call::toHumanStateName(const Call::State cur)
          break;
       case Call::State::CONFERENCE_HOLD:
          return tr( "Conference (hold)" );
-      case Call::State::__COUNT:
+      case Call::State::COUNT__:
          return tr( "ERROR"             );
       case Call::State::INITIALIZATION:
          return tr( "Initialization"    );
@@ -884,7 +884,7 @@ Call::State CallPrivate::stateChanged(const QString& newStateName)
    const Call::State previousState = m_CurrentState;
    if (q_ptr->type() != Call::Type::CONFERENCE) {
       Call::DaemonState dcs = toDaemonCallState(newStateName);
-      if (dcs == Call::DaemonState::__COUNT || m_CurrentState == Call::State::__COUNT) {
+      if (dcs == Call::DaemonState::COUNT__ || m_CurrentState == Call::State::COUNT__) {
          qDebug() << "Error: Invalid state change";
          return Call::State::FAILURE;
       }
@@ -1024,7 +1024,7 @@ Call::State Call::performAction(Call::Action action)
 ///Change the state, do not abuse of this, but it is necessary for error cases
 void CallPrivate::changeCurrentState(Call::State newState)
 {
-   if (newState == Call::State::__COUNT) {
+   if (newState == Call::State::COUNT__) {
       qDebug() << "Error: Call reach invalid state";
       FORCE_ERROR_STATE_P()
       throw newState;
@@ -1384,7 +1384,7 @@ void CallPrivate::warning()
    switch (m_CurrentState) {
       case Call::State::FAILURE        :
       case Call::State::ERROR          :
-      case Call::State::__COUNT          :
+      case Call::State::COUNT__          :
          //If not stopped, then the counter will keep going
          //Getting here indicate something wrong happened
          //It can be normal, aka, an invalid URI such as '><'
@@ -1438,7 +1438,7 @@ void Call::appendText(const QString& str)
    case Call::State::ERROR:
    case Call::State::CONFERENCE:
    case Call::State::CONFERENCE_HOLD:
-   case Call::State::__COUNT:
+   case Call::State::COUNT__:
    default:
       qDebug() << "Backspace on call not editable. Doing nothing.";
       return;
@@ -1481,7 +1481,7 @@ void Call::backspaceItemText()
       case Call::State::ERROR:
       case Call::State::CONFERENCE:
       case Call::State::CONFERENCE_HOLD:
-      case Call::State::__COUNT:
+      case Call::State::COUNT__:
       default                          :
          qDebug() << "Backspace on call not editable. Doing nothing.";
          return;
@@ -1526,7 +1526,7 @@ void Call::reset()
       case Call::State::ERROR            :
       case Call::State::CONFERENCE       :
       case Call::State::CONFERENCE_HOLD  :
-      case Call::State::__COUNT:
+      case Call::State::COUNT__:
       default                            :
          qDebug() << "Cannot reset" << d_ptr->m_CurrentState << "calls";
          return;
diff --git a/src/call.h b/src/call.h
index af049aecfa3cb873aab485ea94a5570a51ebe832..574a97363266e8680414b969c0086eddffb8c730 100644
--- a/src/call.h
+++ b/src/call.h
@@ -129,7 +129,7 @@ public:
       CONFERENCE      = 11,/*!< This call is the current conference*/
       CONFERENCE_HOLD = 12,/*!< This call is a conference on hold*/
       INITIALIZATION  = 13,/*!< The call have been placed, but the peer hasn't confirmed yet */
-      __COUNT,
+      COUNT__,
    };
    Q_ENUMS(State)
 
@@ -173,7 +173,7 @@ public:
       HOLD    = 3, /*!< Call is on hold */
       HUNG_UP = 4, /*!< Call is over  */
       FAILURE = 5, /*!< Call has failed */
-      __COUNT,
+      COUNT__,
    };
 
    /** @enum Call::Action
@@ -186,7 +186,7 @@ public:
       TRANSFER = 2, /*!< Put into or out of transfer mode*/
       HOLD     = 3, /*!< Hold or unhold the call */
       RECORD   = 4, /*!< Enable or disable recording */
-      __COUNT,
+      COUNT__,
    };
 
    /** @enum Call::LifeCycleState
@@ -199,7 +199,7 @@ public:
       INITIALIZATION = 0, /*!< Anything before the media transfer start   */
       PROGRESS       = 1, /*!< The peers are in communication (or hold)   */
       FINISHED       = 2, /*!< Everything is over, there is no going back */
-      __COUNT
+      COUNT__
    };
 
    ///"getHistory()" fields
diff --git a/src/callmodel.cpp b/src/callmodel.cpp
index 62f0b196fc8498ce04b882058c96c801d3beaa36..2b8b9ec88c7a16c855227284e5213191e1314bbf 100644
--- a/src/callmodel.cpp
+++ b/src/callmodel.cpp
@@ -1159,7 +1159,7 @@ void CallModelPrivate::slotCallChanged(Call* call)
          emit q_ptr->callStateChanged(call, Call::State::TRANSFERRED);
          break;
       //Same goes for some errors
-      case Call::State::__COUNT:
+      case Call::State::COUNT__:
       case Call::State::ERROR:
          removeCall(call);
          break;
diff --git a/src/certificate.cpp b/src/certificate.cpp
index 69be50d566c98f7f2742e383ac28b62a624d2cda..ecebf7469e2df4b9afff7afde114f08c436c6630 100644
--- a/src/certificate.cpp
+++ b/src/certificate.cpp
@@ -2,13 +2,13 @@
  *   Copyright (C) 2014-2015 by Savoir-Faire Linux                          *
  *   Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
  *                                                                          *
- *   This library is free software;you can redistribute it and/or          *
+ *   This library is free software you can redistribute it and/or           *
  *   modify it under the terms of the GNU Lesser General Public             *
- *   License as published by the Free Software Foundation;either           *
+ *   License as published by the Free Software Foundation either            *
  *   version 2.1 of the License, or (at your option) any later version.     *
  *                                                                          *
  *   This library is distributed in the hope that it will be useful,        *
- *   but WITHOUT ANY WARRANTY;without even the implied warranty of         *
+ *   but WITHOUT ANY WARRANTY without even the implied warranty of          *
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU      *
  *   Lesser General Public License for more details.                        *
  *                                                                          *
@@ -180,6 +180,26 @@ Certificate::Certificate(Certificate::Type type, const QObject* parent) : QObjec
    d_ptr->m_Type = type;
 }
 
+QString Certificate::getName(Certificate::CertificateCheck check)
+{
+   
+}
+
+QString Certificate::getName(Certificate::CertificateDetails details)
+{
+   
+}
+
+QString Certificate::getDescription(Certificate::CertificateCheck check)
+{
+   
+}
+
+QString Certificate::getDescription(Certificate::CertificateDetails details)
+{
+   
+}
+
 Certificate::CheckValues Certificate::hasPrivateKey() const
 {
    d_ptr->loadChecks();
diff --git a/src/certificate.h b/src/certificate.h
index 3c507260dc4a9fee11ba701b6415bfaeec253aef..acc93ac4575f9f42a4906a7412f1580e1d3ada5a 100644
--- a/src/certificate.h
+++ b/src/certificate.h
@@ -172,6 +172,11 @@ public:
    QVariant checkResults(Certificate::CertificateCheck check) const;
    QVariant detailResult(Certificate::CertificateDetails detail) const;
 
+   QString getName        (Certificate::CertificateCheck   check  );
+   QString getName        (Certificate::CertificateDetails details);
+   QString getDescription (Certificate::CertificateCheck   check  );
+   QString getDescription (Certificate::CertificateDetails details);
+
    //Checks
    CheckValues hasPrivateKey                       () const;
    CheckValues isNotExpired                        () const;
diff --git a/src/certificatemodel.cpp b/src/certificatemodel.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b8c1f30170a6eae97b6e92355ec88edd7e58c56f
--- /dev/null
+++ b/src/certificatemodel.cpp
@@ -0,0 +1,120 @@
+/****************************************************************************
+ *   Copyright (C) 2015 by Savoir-Faire Linux                               *
+ *   Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
+ *                                                                          *
+ *   This library is free software; you can redistribute it and/or          *
+ *   modify it under the terms of the GNU Lesser General Public             *
+ *   License as published by the Free Software Foundation; either           *
+ *   version 2.1 of the License, or (at your option) any later version.     *
+ *                                                                          *
+ *   This library is distributed in the hope that it will be useful,        *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU      *
+ *   Lesser General Public License for more details.                        *
+ *                                                                          *
+ *   You should have received a copy of the GNU General Public License      *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
+ ***************************************************************************/
+#include "certificatemodel.h"
+
+struct CertificateNode {
+
+   enum class Level {
+      CERTIFICATE      = 0,
+      DETAILS_CATEGORY = 1,
+      DETAILS          = 2,
+   };
+
+   CertificateNode();
+   QVector<CertificateNode*> m_lChildren;
+   CertificateNode* m_pParent;
+   Certificate* m_pCertificate;
+   CertificateNode::Level m_Level;
+};
+
+class CertificateModelPrivate
+{
+public:
+   virtual ~CertificateModelPrivate();
+   QVector<CertificateNode*> m_lTopLevelNodes;
+};
+
+CertificateModelPrivate::~CertificateModelPrivate()
+{
+   foreach(CertificateNode* node, m_lTopLevelNodes) {
+      delete node->m_pCertificate;
+      delete node;
+   }
+}
+
+CertificateNode::CertificateNode() : m_pParent(nullptr), m_pCertificate(nullptr)
+{
+   
+}
+
+CertificateModel::CertificateModel(QObject* parent) : QAbstractItemModel(parent),
+ d_ptr(new CertificateModelPrivate())
+{
+   
+}
+
+CertificateModel::~CertificateModel()
+{
+   delete d_ptr;
+}
+
+bool CertificateModel::setData( const QModelIndex& index, const QVariant &value, int role)
+{
+   return false;
+}
+
+QVariant CertificateModel::data( const QModelIndex& index, int role) const
+{
+   
+}
+
+int CertificateModel::rowCount( const QModelIndex& parent) const
+{
+   
+}
+
+Qt::ItemFlags CertificateModel::flags( const QModelIndex& index) const
+{
+   
+}
+
+int CertificateModel::columnCount( const QModelIndex& parent) const
+{
+   return 1;
+}
+
+QModelIndex CertificateModel::parent( const QModelIndex& index) const
+{
+   
+}
+
+QModelIndex CertificateModel::index( int row, int column, const QModelIndex& parent) const
+{
+   
+}
+
+QVariant CertificateModel::headerData( int section, Qt::Orientation orientation, int role ) const
+{
+   
+}
+
+QStringList CertificateModel::mimeTypes() const
+{
+   
+}
+
+QMimeData* CertificateModel::mimeData( const QModelIndexList &indexes) const
+{
+   
+}
+
+bool CertificateModel::dropMimeData( const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent )
+{
+   
+}
+
diff --git a/src/certificatemodel.h b/src/certificatemodel.h
new file mode 100644
index 0000000000000000000000000000000000000000..e44ba42bc7f44884bd0afa409d481e3f31665dea
--- /dev/null
+++ b/src/certificatemodel.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+ *   Copyright (C) 2015 by Savoir-Faire Linux                               *
+ *   Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
+ *                                                                          *
+ *   This library is free software; you can redistribute it and/or          *
+ *   modify it under the terms of the GNU Lesser General Public             *
+ *   License as published by the Free Software Foundation; either           *
+ *   version 2.1 of the License, or (at your option) any later version.     *
+ *                                                                          *
+ *   This library is distributed in the hope that it will be useful,        *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU      *
+ *   Lesser General Public License for more details.                        *
+ *                                                                          *
+ *   You should have received a copy of the GNU General Public License      *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
+ ***************************************************************************/
+#ifndef CERTIFICATE_MODEL_H
+#define CERTIFICATE_MODEL_H
+#include <QtCore/QAbstractItemModel>
+#include "typedefs.h"
+
+class CertificateModelPrivate;
+
+class LIB_EXPORT CertificateModel : public QAbstractItemModel
+{
+   Q_OBJECT
+public:
+
+   CertificateModel(QObject* parent);
+   virtual ~CertificateModel();
+
+   //Model implementation
+   virtual bool          setData      ( const QModelIndex& index, const QVariant &value, int role   ) override;
+   virtual QVariant      data         ( const QModelIndex& index, int role = Qt::DisplayRole        ) const override;
+   virtual int           rowCount     ( const QModelIndex& parent = QModelIndex()                   ) const override;
+   virtual Qt::ItemFlags flags        ( const QModelIndex& index                                    ) const override;
+   virtual int           columnCount  ( const QModelIndex& parent = QModelIndex()                   ) const override;
+   virtual QModelIndex   parent       ( const QModelIndex& index                                    ) const override;
+   virtual QModelIndex   index        ( int row, int column, const QModelIndex& parent=QModelIndex()) const override;
+   virtual QVariant      headerData   ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
+   virtual QStringList   mimeTypes    (                                                             ) const override;
+   virtual QMimeData*    mimeData     ( const QModelIndexList &indexes                              ) const override;
+   virtual bool          dropMimeData ( const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent ) override;
+
+private:
+   CertificateModelPrivate* d_ptr;
+   Q_DECLARE_PRIVATE(CertificateModelPrivate);
+};
+
+#endif
\ No newline at end of file
diff --git a/src/keyexchangemodel.cpp b/src/keyexchangemodel.cpp
index 1db20559afefcc351a7a8a88a1a67b1ede80944b..e23d4e4285909e4a395e839e8213e1d41864f3ed 100644
--- a/src/keyexchangemodel.cpp
+++ b/src/keyexchangemodel.cpp
@@ -69,7 +69,7 @@ QVariant KeyExchangeModel::data( const QModelIndex& index, int role) const
          case KeyExchangeModel::Type::SDES:
             return KeyExchangeModel::Name::SDES;
             break;
-         case KeyExchangeModel::Type::__COUNT:
+         case KeyExchangeModel::Type::COUNT__:
             break;
       };
    }
@@ -114,7 +114,7 @@ const char* KeyExchangeModel::toDaemonName(KeyExchangeModel::Type type)
       case KeyExchangeModel::Type::SDES:
          return KeyExchangeModel::DaemonName::SDES;
          break;
-      case KeyExchangeModel::Type::__COUNT:
+      case KeyExchangeModel::Type::COUNT__:
          break;
    };
    return nullptr; //Cannot heppen
diff --git a/src/keyexchangemodel.h b/src/keyexchangemodel.h
index c24c73c599a3480d6eeb26d7699d984a530ee864..5b28ae23e4a6d1237961c7cb8ce7d4ac2af29a7c 100644
--- a/src/keyexchangemodel.h
+++ b/src/keyexchangemodel.h
@@ -39,7 +39,7 @@ public:
       ZRTP = 0,
       SDES = 1,
       NONE = 2,
-      __COUNT,
+      COUNT__,
    };
 
    ///@enum Options Every Key exchange options
@@ -49,7 +49,7 @@ public:
       NOT_SUPP_WARNING = 2,
       HELLO_HASH       = 3,
       DISPLAY_SAS_ONCE = 4,
-      __COUNT,
+      COUNT__,
    };
 
    class Name {
diff --git a/src/securityvalidationmodel.h b/src/securityvalidationmodel.h
index 27052393d27920c74b654362e03ac80319e5da99..c88064618b193e9f4f25eb0a62a389f6cdccb8e2 100644
--- a/src/securityvalidationmodel.h
+++ b/src/securityvalidationmodel.h
@@ -90,7 +90,7 @@ public:
       REQUIRE_CERTIFICATE_DISABLED   ,
       MISSING_CERTIFICATE            ,
       MISSING_AUTHORITY              ,
-      __COUNT
+      COUNT__
    };
 
    ///Role for the model
diff --git a/src/typedefs.h b/src/typedefs.h
index d9c2c07ca72166db626b0fb3d0c0ef01652c7a82..2cbae28764dee15bce6ec44bf7a7a69d7c3bd23c 100644
--- a/src/typedefs.h
+++ b/src/typedefs.h
@@ -20,12 +20,18 @@
 #ifndef TYPEDEFS_H
 #define TYPEDEFS_H
 
+//Qt
 #include <QtCore/QMetaType>
 #include <QtCore/QMap>
 #include <QVector>
 #include <QtCore/QString>
 #include <QtCore/QDebug>
 
+//libSTDC++
+#include <initializer_list>
+#include <type_traits>
+
+//Typedefs (required to avoid '<' and '>' in the DBus XML)
 typedef QMap<QString, QString> MapStringString;
 typedef QVector< QMap<QString, QString> > VectorMapStringString;
 typedef QMap< QString, QMap< QString, QVector<QString> > > MapStringMapStringVectorString;
@@ -34,32 +40,126 @@ typedef QMap<QString, int> MapStringInt;
 template<class T, class E>
 struct TypedStateMachine
 {
-    // no ctor/dtor and one public member variable for easy initialization
-    T _data[size_t(E::__COUNT)];
-
-    T& operator[](E v) {
-      if (size_t(v) >= size_t(E::__COUNT)) {
-         qDebug() << "State Machine Out of Bound" << size_t(v);
-         throw v;
-      }
-      return _data[size_t(v)];
-    }
-
-    const T& operator[](E v) const {
-      if (size_t(v) >= size_t(E::__COUNT)) {
-         qDebug() << "State Machine Out of Bound" << size_t(v);
-         throw v;
-      }
-      return _data[size_t(v)];
-    }
-
-    T *begin() {
-      return _data;
-    }
-
-    T *end() {
-      return _data + size_t(E::__COUNT);
-    }
+   // no ctor/dtor and one public member variable for easy initialization
+   T _data[size_t(E::COUNT__)];
+
+   T& operator[](E v) {
+   if (size_t(v) >= size_t(E::COUNT__)) {
+      qDebug() << "State Machine Out of Bound" << size_t(v);
+      throw v;
+   }
+   return _data[size_t(v)];
+   }
+
+   const T& operator[](E v) const {
+   if (size_t(v) >= size_t(E::COUNT__)) {
+      qDebug() << "State Machine Out of Bound" << size_t(v);
+      throw v;
+   }
+   return _data[size_t(v)];
+   }
+
+   T *begin() {
+   return _data;
+   }
+
+   T *end() {
+   return _data + size_t(E::COUNT__);
+   }
+};
+
+
+/**
+ * This generic class represents a multidimensional enum class array.
+ * It safely converts them to integers. Each enum class needs a "COUNT__" item
+ * at the end."
+ *
+ * This struct enforces:
+ * * That the rows are indexed using enum_classes
+ * * That the size of the matrix matches the enum_class size
+ * * That the operators are within the matrix boundary
+ */
+template<class Row, typename Value, typename A = Value>
+struct Matrix1D
+{
+
+   Matrix1D(std::initializer_list< std::initializer_list<Value> > s);
+
+   // Row is a built-in type ("int" by default)
+   Value operator[](Row v);
+
+   const Value operator[](Row v) const;
+
+   /**
+   * An Iterator for enum classes
+   */
+   class EnumClassIter
+   {
+   public:
+      EnumClassIter (const Matrix1D<Row, Value, A>* p_vec, int pos)
+         : pos_( pos ), p_vec_( p_vec ) {}
+
+      bool operator!= (const EnumClassIter& other) const;
+      Row operator* () const;
+      const EnumClassIter& operator++ ();
+
+   private:
+      int pos_;
+      const Matrix1D<Row, Value, A> *p_vec_;
+   };
+
+   //Iterators
+   EnumClassIter begin();
+   EnumClassIter end();
+
+   // Only use for single reverse mappable arrays, will ASSERT otherwise
+   Row fromValue(const Value& value) const;
+
+   static void setReverseMapping(Matrix1D<Row,const char *> names);
+
+private:
+   const QVector<Value> m_lData;
+   static QMap<A, Row> m_hReverseMapping;
+};
+
+
+/**
+ * A matrix with no value
+ *
+ * This is useful to use enum class in C++11 foreach loops
+ *
+ * @usage
+ *   for (const MyEnum& value : EnumIterator<MyEnum>()) {
+ *       std::cout << "Name: " << MyEnumNames[value] << std::endl;
+ *   }
+ */
+template<class EnumClass>
+struct EnumIterator
+{
+
+   /**
+   * An Iterator for enum classes
+   */
+   class EnumClassIter
+   {
+   public:
+      EnumClassIter (const EnumIterator<EnumClass>* p_vec, int pos)
+         : pos_( pos ), p_vec_( p_vec ) {}
+
+      bool operator!= (const EnumClassIter& other) const;
+      EnumClass operator* () const;
+      const EnumClassIter& operator++ ();
+
+   private:
+      int pos_;
+      const EnumIterator<EnumClass> *p_vec_;
+   };
+
+   EnumIterator();
+
+   //Iterators
+   EnumClassIter begin();
+   EnumClassIter end();
 };
 
 /**
@@ -68,7 +168,7 @@ struct TypedStateMachine
  * @note it cannot be unsigned to avoid some compiler warnings
  */
 template<typename A> constexpr int enum_class_size() {
-   return static_cast<int>(A::__COUNT);
+   return static_cast<int>(A::COUNT__);
 }
 
 #define LIB_EXPORT Q_DECL_EXPORT
@@ -89,4 +189,8 @@ template<typename A> constexpr int enum_class_size() {
 #else
    #define IGNORE_NULL(content) content
 #endif //ENABLE_IGNORE_NULL
-#endif
+
+#include "typedefs.hpp"
+
+#endif //TYPEDEFS_H
+
diff --git a/src/typedefs.hpp b/src/typedefs.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..b24568f94232ab3e3f3335cd1da8610a0b3a6d83
--- /dev/null
+++ b/src/typedefs.hpp
@@ -0,0 +1,115 @@
+/****************************************************************************
+ *   Copyright (C) 2009-2015 by Savoir-Faire Linux                          *
+ *   Author : J�r�my Quentin <jeremy.quentin@savoirfairelinux.com>          *
+ *            Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
+ *                                                                          *
+ *   This library is free software; you can redistribute it and/or          *
+ *   modify it under the terms of the GNU Lesser General Public             *
+ *   License as published by the Free Software Foundation; either           *
+ *   version 2.1 of the License, or (at your option) any later version.     *
+ *                                                                          *
+ *   This library is distributed in the hope that it will be useful,        *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU      *
+ *   Lesser General Public License for more details.                        *
+ *                                                                          *
+ *   You should have received a copy of the GNU General Public License      *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
+ ***************************************************************************/
+
+template<class EnumClass >
+EnumIterator<EnumClass>::EnumIterator() {
+   static_assert(std::is_enum<EnumClass>(),"The first template parameter has to be an enum class\n");
+}
+
+template<class EnumClass >
+EnumClass EnumIterator<EnumClass>::EnumClassIter::operator* () const
+{
+   Q_ASSERT(pos_ < enum_class_size<EnumClass>());
+   return static_cast<EnumClass>(pos_);
+}
+
+template<class EnumClass >
+const typename EnumIterator<EnumClass>::EnumClassIter& EnumIterator<EnumClass>::EnumClassIter::operator++ ()
+{
+   ++pos_;
+   return *this;
+}
+
+template<class EnumClass >
+bool EnumIterator<EnumClass>::EnumClassIter::operator!= (const EnumClassIter& other) const
+{
+   return pos_ != other.pos_;
+}
+
+template< class EnumClass >
+typename EnumIterator<EnumClass>::EnumClassIter EnumIterator<EnumClass>::begin()
+{
+   return EnumIterator<EnumClass>::EnumClassIter( this, 0 );
+}
+
+template<class EnumClass >
+typename EnumIterator<EnumClass>::EnumClassIter EnumIterator<EnumClass>::end()
+{
+   return EnumIterator<EnumClass>::EnumClassIter( this, enum_class_size<EnumClass>() );
+}
+
+
+
+
+
+template<class Row, typename Value, typename Accessor>
+Matrix1D<Row,Value,Accessor>::Matrix1D(std::initializer_list< std::initializer_list<Value>> s)
+: m_lData(*std::begin(s)) {
+   static_assert(std::is_enum<Row>(),"Row has to be an enum class");
+   static_assert((int)Row::COUNT__ > 0,"Row need a COUNT__ element");
+
+   // FIXME C++14, use static_assert and make the ctor constexpr
+   Q_ASSERT(std::begin(s)->size() == enum_class_size<Row>());//,"Matrix row have to match the enum class size");
+}
+
+template<class Row, typename Value, typename Accessor>
+Value Matrix1D<Row,Value,Accessor>::operator[](Row v) {
+   //ASSERT(size_t(v) >= size_t(Row::COUNT__),"State Machine Out of Bounds\n");
+   if (size_t(v) >= enum_class_size<Row>() || static_cast<int>(v) < 0) {
+      qWarning() << "State Machine Out of Bounds" << size_t(v);
+      Q_ASSERT(false);
+      throw v;
+   }
+   return m_lData[size_t(v)];
+}
+
+template<class Row, typename Value, typename Accessor>
+const Value Matrix1D<Row,Value,Accessor>::operator[](Row v) const {
+   Q_ASSERT(size_t(v) <= enum_class_size<Row>()+1 && size_t(v)>=0); //COUNT__ is also valid
+   if (size_t(v) >= enum_class_size<Row>()) {
+      qWarning() << "State Machine Out of Bounds" << size_t(v);
+      Q_ASSERT(false);
+      throw v;
+   }
+   return m_lData[size_t(v)];
+}
+
+template <class E, class T, class A> QMap<A,E> Matrix1D<E,T,A>::m_hReverseMapping;
+
+template<class Row, typename Value, typename Accessor>
+void Matrix1D<Row,Value,Accessor>::setReverseMapping(Matrix1D<Row,const char*> names)
+{
+   for ( const Row row : EnumIterator<Row>() )
+      m_hReverseMapping[names[row]] = row;
+}
+
+template<class Row, typename Value, typename Accessor>
+Row Matrix1D<Row,Value,Accessor>::fromValue(const Value& value) const {
+    if (!m_hReverseMapping.empty()) {
+         for (int i = 0; i < enum_class_size<Row>();i++) {
+            const_cast<Matrix1D*>(this)->m_hReverseMapping[(*const_cast<Matrix1D*>(this))[(Row)i]]
+               = static_cast<Row>(i);
+         }
+         Q_ASSERT(m_hReverseMapping.empty() == enum_class_size<Row>());
+    }
+    if (m_hReverseMapping.count(value) == 0) {
+      throw value;
+    }
+    return m_hReverseMapping[value];
+}
diff --git a/src/useractionmodel.h b/src/useractionmodel.h
index b49143bc2d039630ed9e8da7b4e053fe06e80762..d0ca7e4afd94a82f8200ff75cdede440d1a349f3 100644
--- a/src/useractionmodel.h
+++ b/src/useractionmodel.h
@@ -54,7 +54,7 @@ public:
       REFUSE   = 6,
       ACCEPT   = 7,
       HANGUP   = 8,
-      __COUNT,
+      COUNT__,
    };
    Q_ENUMS(Action)
 
diff --git a/src/video/sourcesmodel.cpp b/src/video/sourcesmodel.cpp
index 40293a02c88a88744d9f78c2e84d5a3af1e6bc7d..dae4830e79f2b5dba50d2241a88cc10d233cf49a 100644
--- a/src/video/sourcesmodel.cpp
+++ b/src/video/sourcesmodel.cpp
@@ -90,7 +90,7 @@ QVariant Video::SourcesModel::data( const QModelIndex& index, int role ) const
          };
          break;
       default:
-         return Video::DeviceModel::instance()->data(Video::DeviceModel::instance()->index(index.row()-ExtendedDeviceList::__COUNT,0),role);
+         return Video::DeviceModel::instance()->data(Video::DeviceModel::instance()->index(index.row()-ExtendedDeviceList::COUNT__,0),role);
    };
    return QVariant();
 }
@@ -98,7 +98,7 @@ QVariant Video::SourcesModel::data( const QModelIndex& index, int role ) const
 int Video::SourcesModel::rowCount( const QModelIndex& parent ) const
 {
    Q_UNUSED(parent)
-   return Video::DeviceModel::instance()->rowCount() + ExtendedDeviceList::__COUNT;
+   return Video::DeviceModel::instance()->rowCount() + ExtendedDeviceList::COUNT__;
 }
 
 Qt::ItemFlags Video::SourcesModel::flags( const QModelIndex& idx ) const
@@ -110,7 +110,7 @@ Qt::ItemFlags Video::SourcesModel::flags( const QModelIndex& idx ) const
          return QAbstractItemModel::flags(idx) | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable;
          break;
       default:
-         return Video::DeviceModel::instance()->flags(Video::DeviceModel::instance()->index(idx.row()-ExtendedDeviceList::__COUNT,0));
+         return Video::DeviceModel::instance()->flags(Video::DeviceModel::instance()->index(idx.row()-ExtendedDeviceList::COUNT__,0));
    };
 }
 
@@ -147,7 +147,7 @@ void Video::SourcesModel::switchTo(const int idx)
          break;
       default:
          DBus::VideoManager::instance().switchInput(Video::SourcesModelPrivate::ProtocolPrefix::V4L2 +
-            Video::DeviceModel::instance()->index(idx-ExtendedDeviceList::__COUNT,0).data(Qt::DisplayRole).toString());
+            Video::DeviceModel::instance()->index(idx-ExtendedDeviceList::COUNT__,0).data(Qt::DisplayRole).toString());
          break;
    };
    d_ptr->m_CurrentSelection = (ExtendedDeviceList) idx;
@@ -167,14 +167,14 @@ Video::Device* Video::SourcesModel::deviceAt(const QModelIndex& idx) const
       case ExtendedDeviceList::FILE:
          return nullptr;
       default:
-         return Video::DeviceModel::instance()->devices()[idx.row()-ExtendedDeviceList::__COUNT];
+         return Video::DeviceModel::instance()->devices()[idx.row()-ExtendedDeviceList::COUNT__];
    };
 }
 
 int Video::SourcesModel::activeIndex() const
 {
    if (d_ptr->m_CurrentSelection == -1) {
-      return ExtendedDeviceList::__COUNT + Video::DeviceModel::instance()->activeIndex();
+      return ExtendedDeviceList::COUNT__ + Video::DeviceModel::instance()->activeIndex();
    }
    return d_ptr->m_CurrentSelection;
 }
diff --git a/src/video/sourcesmodel.h b/src/video/sourcesmodel.h
index b8db7319ae92da18c2bffd64e8e8c98738dd8317..23c0cf6b33264f94cc3e629dd660fae341725afb 100644
--- a/src/video/sourcesmodel.h
+++ b/src/video/sourcesmodel.h
@@ -36,7 +36,7 @@ public:
       NONE   ,
       SCREEN ,
       FILE   ,
-      __COUNT
+      COUNT__
    };
    virtual QVariant      data     ( const QModelIndex& index, int role = Qt::DisplayRole     ) const override;
    virtual int           rowCount ( const QModelIndex& parent = QModelIndex()                ) const override;