From 1f53ec7eca86a861f5091d5e1508c3b2e00c58e8 Mon Sep 17 00:00:00 2001
From: Chris Tallon <chris@vomp.tv>
Date: Sun, 26 Jan 2020 21:33:03 +0000
Subject: [PATCH] v0.6 dev Update some GPL headers Don't import std by "using
 namespace std" Start implementing brace-init initialisation General code
 cleanup Start implementing things calling MessageQueue::postMessage* instead
 of Command:: Removed Osd::init() parameter Removed some log lines, some old
 comments

---
 audioomx.cc             |   2 +-
 audioomx.h              |   4 +-
 audiowin.h              |   6 +-
 boxstack.cc             |   2 +-
 boxx.cc                 |   8 +-
 boxx.h                  |   4 +-
 channel.h               |   3 +-
 command.cc              | 370 +++++++++++++++++++---------------------
 command.h               |  48 +++---
 defines.h               |   3 -
 directory.cc            |   6 +-
 directory.h             |   5 +-
 draintarget.h           |   3 +-
 dsallocator.h           | 151 ++++++++--------
 eventdispatcher.h       |   5 +-
 i18n.cc                 |   5 +-
 imageomx.cc             |   2 +-
 imageomx.h              |  50 +++---
 main.cc                 |   2 +-
 mark.h                  |   4 +-
 media.h                 |   6 +-
 mediaoptions.h          |   3 +-
 mediaplayer.h           |   3 +-
 messagequeue.cc         |  13 +-
 messagequeue.h          |  14 +-
 option.h                |   6 +-
 osd.h                   |   2 +-
 osddirectfb.cc          |   2 +-
 osddirectfb.h           |   2 +-
 osdopengl.cc            |   5 +-
 osdopengl.h             |   2 +-
 osdopenvg.cc            |  16 +-
 osdopenvg.h             |  66 ++++---
 osdvector.cc            |  44 ++---
 osdvector.h             |  33 ++--
 osdwinpixel.cc          |   2 +-
 osdwinpixel.h           |   2 +-
 osdwinvector.cc         |   2 +-
 osdwinvector.h          |   2 +-
 playerliveradio.h       |   4 +-
 playerlivetv.h          |   4 +-
 recman.cc               |   2 +-
 remote.h                |   3 +-
 remotelinux.cc          |  24 ++-
 remotelinux.h           |   2 +-
 serialize.h             |  15 +-
 surfacevector.cc        |   8 +-
 teletextdecodervbiebu.h |  13 +-
 timers.h                |   4 +-
 vaudioselector.cc       |  16 +-
 vaudioselector.h        |   3 +-
 vdp6.h                  |   4 +-
 vdr.cc                  |  12 +-
 vdr.h                   |  13 +-
 vepg.cc                 |   8 +-
 videoomx.cc             |  18 +-
 videoomx.h              |  10 +-
 videowin.h              |   3 +-
 vmedialist.cc           |  11 +-
 vopts.cc                |  27 +--
 vopts.h                 |  12 +-
 vquestion.cc            |   7 +-
 vquestion.h             |   3 +-
 vrecordinglist.h        |   2 +-
 vserverselect.cc        |   2 +-
 vserverselect.h         |   4 +-
 vsleeptimer.cc          |  13 +-
 vsleeptimer.h           |   2 +-
 vvideolivetv.cc         |   2 +-
 vvolume.cc              |   4 +-
 vwelcome.cc             |   8 +-
 winmain.cc              |   2 +-
 woptionpane.h           |   6 +-
 wpictureview.cc         |   6 +-
 wpictureview.h          |   2 +-
 wselectlist.h           |   4 +-
 wtabbar.h               |   2 +-
 77 files changed, 552 insertions(+), 641 deletions(-)

diff --git a/audioomx.cc b/audioomx.cc
index 58c29cb..94f5137 100644
--- a/audioomx.cc
+++ b/audioomx.cc
@@ -1276,7 +1276,7 @@ int AudioOMX::DestroyInputBufsOMXwhilePlaying() //call with clock mutex locked
 	while (input_bufs_omx_all.size()>0) {
 		if (input_bufs_omx_free.size()>0) {
 			// Destroy one buffer
-			vector<OMX_BUFFERHEADERTYPE*>::iterator itty=input_bufs_omx_all.begin();
+			std::vector<OMX_BUFFERHEADERTYPE*>::iterator itty=input_bufs_omx_all.begin();
 			OMX_BUFFERHEADERTYPE* cur_buf=input_bufs_omx_free.front();
 			for (; itty!= input_bufs_omx_all.end();itty++) {
 				if ((*itty)==cur_buf) {
diff --git a/audioomx.h b/audioomx.h
index 5a3b18d..3260380 100644
--- a/audioomx.h
+++ b/audioomx.h
@@ -167,8 +167,8 @@ class AudioOMX : public Audio
 	int ChangeAudioDestination();
 	long long correctAudioLatency(long long pts,int addsamples,int srate);
 
-	vector<OMX_BUFFERHEADERTYPE*> input_bufs_omx_all;
-	list<OMX_BUFFERHEADERTYPE*> input_bufs_omx_free;
+	std::vector<OMX_BUFFERHEADERTYPE*> input_bufs_omx_all;
+	std::list<OMX_BUFFERHEADERTYPE*> input_bufs_omx_free;
 	Mutex input_bufs_omx_mutex;
 	OMX_BUFFERHEADERTYPE* cur_input_buf_omx;
 
diff --git a/audiowin.h b/audiowin.h
index e1b087c..c3eed89 100644
--- a/audiowin.h
+++ b/audiowin.h
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #ifndef AUDIOWIN_H
@@ -34,8 +33,7 @@ struct AudioFilterDesc {
     char * displayname;
     char * friendlyname;
 };
-using namespace std;
-typedef vector<AudioFilterDesc> AudioFilterDescList;
+typedef std::vector<AudioFilterDesc> AudioFilterDescList;
 
 class AudioWin : public Audio
 {
diff --git a/boxstack.cc b/boxstack.cc
index fe26a21..1776c61 100644
--- a/boxstack.cc
+++ b/boxstack.cc
@@ -69,7 +69,7 @@ void BoxStack::removeAll()
 int BoxStack::addVideoDisplay(Boxx* box,VideoDisplay vd)
 {
 	  boxLock.Lock();
-	  videoStack.push(pair<Boxx*,VideoDisplay>(box,vd));
+	  videoStack.push(std::pair<Boxx*,VideoDisplay>(box,vd));
 	  boxLock.Unlock();
 	  Video::getInstance()->setVideoDisplay(vd);
 	  return 1;
diff --git a/boxx.cc b/boxx.cc
index 73e8171..21bdb9c 100644
--- a/boxx.cc
+++ b/boxx.cc
@@ -64,7 +64,7 @@ void Boxx::draw()
   if (backgroundColourSet) fillColour(backgroundColour);
 
   Boxx* currentBoxx;
-  vector<Boxx*>::iterator j;
+  std::vector<Boxx*>::iterator j;
   //int count=0;
   for (j = children.begin(); j != children.end(); j++)
   {
@@ -103,7 +103,7 @@ void Boxx::add(Boxx* newChild)
 
 void Boxx::remove(Boxx* oldChild)
 {
-  for(vector<Boxx*>::iterator i = children.begin(); i != children.end(); i++)
+  for(std::vector<Boxx*>::iterator i = children.begin(); i != children.end(); i++)
   {
     if (*i == oldChild)
     {
@@ -116,7 +116,7 @@ void Boxx::remove(Boxx* oldChild)
 
 void Boxx::removeVisibleChilds(Region & r)
 {
-	for(vector<Boxx*>::iterator i = children.begin(); i != children.end(); i++)
+	for(std::vector<Boxx*>::iterator i = children.begin(); i != children.end(); i++)
 	{
 		if ((*i)->getVisible())
 		{
@@ -264,7 +264,7 @@ void Boxx::getRootBoxRegion(Region* r)
 
 bool Boxx::getVideoDisplay(VideoDisplay &vd)
 {
-	for(vector<Boxx*>::iterator i = children.begin(); i != children.end(); i++)
+	for(std::vector<Boxx*>::iterator i = children.begin(); i != children.end(); i++)
 	{
 		if ((*i)->getVideoDisplay(vd)) return true;
 	}
diff --git a/boxx.h b/boxx.h
index abd97c6..6041513 100644
--- a/boxx.h
+++ b/boxx.h
@@ -23,8 +23,6 @@
 #include <stdio.h>
 #include <vector>
 
-using namespace std;
-
 #include "colour.h"
 #include "region.h"
 #include "message.h"
@@ -144,7 +142,7 @@ class Boxx
     Surface *getSurface();
     Boxx* parent;
     Region area;
-    vector<Boxx*> children;
+    std::vector<Boxx*> children;
     VideoDisplay vdisplay;
 
     void setParent(Boxx*);    
diff --git a/channel.h b/channel.h
index bb9ea8f..c6587fd 100644
--- a/channel.h
+++ b/channel.h
@@ -26,7 +26,6 @@
 
 #include "defines.h"
 
-using namespace std;
 // A struct to hold a audio pid pair
 
 typedef struct _apid
@@ -38,7 +37,7 @@ typedef struct _apid
   ULONG data2;
 } apid;
 
-typedef vector<apid> APidList;
+typedef std::vector<apid> APidList;
 
 class Channel
 {
diff --git a/command.cc b/command.cc
index a77129a..34b95c1 100644
--- a/command.cc
+++ b/command.cc
@@ -1,5 +1,5 @@
 /*
-    Copyright 2004-2005 Chris Tallon
+    Copyright 2004-2020 Chris Tallon
 
     This file is part of VOMP.
 
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #ifndef WIN32
@@ -64,14 +63,6 @@ Command::Command()
 {
   if (instance) return;
   instance = this;
-  initted = 0;
-  isStandby = 0;
-  firstBoot = 1;
-  signals = 0;
-  connLost = NULL;
-  crashed = false;
-  server = NULL;
-  wallpaper = wallpaper_pict = NULL;
 }
 
 Command::~Command()
@@ -87,7 +78,7 @@ Command* Command::getInstance()
 int Command::init(bool tcrashed, char* tServer)
 {
   if (initted) return 0;
-  initted = 1;
+  initted = true;
   crashed = tcrashed;
   server = tServer;
 
@@ -99,7 +90,7 @@ int Command::init(bool tcrashed, char* tServer)
   
   if (!logger || !boxstack || !remote)
   {
-    initted = 0;
+    initted = false;
     return 0;
   }
 
@@ -108,7 +99,7 @@ int Command::init(bool tcrashed, char* tServer)
 #ifndef WIN32
   pthread_mutex_init(&masterLock, NULL);
 #else
-  masterLock=CreateMutex(NULL,FALSE,NULL);
+  masterLock = CreateMutex(NULL, FALSE, NULL);
 #endif
 
   return 1;
@@ -117,85 +108,73 @@ int Command::init(bool tcrashed, char* tServer)
 int Command::shutdown()
 {
   if (!initted) return 0;
-  initted = 0;
+  initted = false;
   return 1;
 }
 
 void Command::stop()
 {
-//  VDR::getInstance()->cancelFindingServer();
-	logger->log("Command", Log::NOTICE, "Command stop1...");
-	
+  logger->log("Command", Log::NOTICE, "stop");
   udp.shutdown();
-  logger->log("Command", Log::NOTICE,  "Command stop2...");
-  irun = 0;
+  irun = false;
 }
 
 void Command::doWallpaper()
 {
-	Video* video = Video::getInstance();
-
-	// Blue background
-	Boxx* bbg = new Boxx();
-	bbg->setSize(video->getScreenWidth(), video->getScreenHeight());
-	bbg->createBuffer();
-	bbg->fillColour(DrawStyle::WALLPAPER);
-	boxstack->add(bbg);
-	boxstack->update(bbg);
-	boxstack->remove(bbg);
-
-	// Wallpaper
-	wallpaper = new Boxx();
-	wallpaper->setSize(video->getScreenWidth(), video->getScreenHeight());
-	wallpaper->createBuffer();
-	wallpaper ->setBackgroundColour(DrawStyle::WALLPAPER);
-
-
+  Video* video = Video::getInstance();
 
+  // Blue background
+  Boxx* bbg = new Boxx();
+  bbg->setSize(video->getScreenWidth(), video->getScreenHeight());
+  bbg->createBuffer();
+  bbg->fillColour(DrawStyle::WALLPAPER);
+  boxstack->add(bbg);
+  boxstack->update(bbg);
+  boxstack->remove(bbg);
 
-	wallpaper_pict = new WJpegTYPE();
-	wallpaper_pict->setSize(video->getScreenWidth(), video->getScreenHeight());
+  // Wallpaper
+  wallpaper = new Boxx();
+  wallpaper->setSize(video->getScreenWidth(), video->getScreenHeight());
+  wallpaper->createBuffer();
+  wallpaper->setBackgroundColour(DrawStyle::WALLPAPER);
 
+  wallpaper_pict = new WJpegTYPE();
+  wallpaper_pict->setSize(video->getScreenWidth(), video->getScreenHeight());
 
-	if (video->getFormat() == Video::PAL)
-	{
-		logger->log("Command", Log::DEBUG, "PAL wallpaper selected");
+  if (video->getFormat() == Video::PAL)
+  {
+    logger->log("Command", Log::DEBUG, "PAL wallpaper selected");
 #ifndef _MIPS_ARCH    
-		wallpaper_pict->init("/wallpaperPAL.jpg");
+    wallpaper_pict->init("/wallpaperPAL.jpg");
 #else
-		wallpaper_pict->init("wallpaperPAL.jpg");
+    wallpaper_pict->init("wallpaperPAL.jpg");
 #endif
-	}
-	else
-	{
-		logger->log("Command", Log::DEBUG, "NTSC wallpaper selected");
-		wallpaper_pict->init("/wallpaperNTSC.jpg");
-	}
-	if (DrawStyle::WALLPAPER.alpha) {
-		wallpaper_pict->setVisible(true);
-	} else {
-		wallpaper_pict->setVisible(false);
-	}
-	wallpaper->add(wallpaper_pict);
-	wallpaper->draw();
-
-	boxstack->add(wallpaper);
-	boxstack->update(wallpaper);
-
-    OsdVector* osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
-    if (osdv)
-    {
-  	  osdv->updateBackgroundColor(DrawStyle::WALLPAPER);
-    }
+  }
+  else
+  {
+    logger->log("Command", Log::DEBUG, "NTSC wallpaper selected");
+    wallpaper_pict->init("/wallpaperNTSC.jpg");
+  }
+
+  if (DrawStyle::WALLPAPER.alpha)
+    wallpaper_pict->setVisible(true);
+  else
+    wallpaper_pict->setVisible(false);
 
+  wallpaper->add(wallpaper_pict);
+  wallpaper->draw();
 
+  boxstack->add(wallpaper);
+  boxstack->update(wallpaper);
 
+  OsdVector* osdv = dynamic_cast<OsdVector*>(Osd::getInstance());
+  if (osdv) osdv->updateBackgroundColor(DrawStyle::WALLPAPER);
 }
 
 void Command::run()
 {
   if (!initted) return;
-  irun = 1;
+  irun = true;
 #ifndef WIN32
   mainPid = getpid();
 #endif
@@ -207,13 +186,11 @@ void Command::run()
   doWallpaper();
 
   // End of startup. Lock the mutex and put the first view up
-//  logger->log("Command", Log::DEBUG, "WANT LOCK");
 #ifndef WIN32
   pthread_mutex_lock(&masterLock);
 #else
   WaitForSingleObject(masterLock, INFINITE );
 #endif
-  //logger->log("Command", Log::DEBUG, "LOCKED");
 
   if (crashed)
   {
@@ -233,7 +210,6 @@ void Command::run()
   while(irun)
   {
     // unlock and wait
-    //logger->log("Command", Log::DEBUG, "UNLOCK");
 #ifndef WIN32
     pthread_mutex_unlock(&masterLock);
 #else
@@ -243,34 +219,27 @@ void Command::run()
     // something happened, lock and process
     if (signals) processSignals(); // If a signal arrived process now.
 
-    //  logger->log("Command", Log::DEBUG, "WANT LOCK");
 #ifndef WIN32
     pthread_mutex_lock(&masterLock);
 #else
     WaitForSingleObject(masterLock, INFINITE );
 #endif
-    // logger->log("Command", Log::DEBUG, "LOCK");
 
-    if ((button == Remote::NA_NONE) /*|| (button == Remote::NA_UNKNOWN)*/) continue;
+    if (button == Remote::NA_NONE) continue;
 
     if (button != Remote::NA_SIGNAL) handleCommand(button);
     processMessageQueue();
-
   }
 
-  //logger->log("Command", Log::DEBUG, "UNLOCK");
 #ifndef WIN32
   pthread_mutex_unlock(&masterLock);
 #else
   ReleaseMutex(masterLock);
 #endif
 
-
-
   boxstack->removeAllExceptWallpaper();
   boxstack->remove(wallpaper);
   delete wallpaper_pict; wallpaper_pict = NULL; wallpaper = NULL;
-
 }
 
 void Command::setSignal(int signalReceived)
@@ -334,13 +303,11 @@ void Command::postMessage(Message* m)
   // locking the mutex ensures that the master thread is waiting on getButtonPress
 
 
-  //logger->log("Command", Log::DEBUG, "WANT LOCK");
 #ifndef WIN32
   pthread_mutex_lock(&masterLock);
 #else
   WaitForSingleObject(masterLock, INFINITE );
 #endif
-  //logger->log("Command", Log::DEBUG, "LOCK");
   MessageQueue::postMessage(m);
 
 #ifndef WIN32
@@ -354,10 +321,9 @@ void Command::postMessage(Message* m)
   ((RemoteWin*)Remote::getInstance())->Signal();
   ReleaseMutex(masterLock);
 #endif
-  //logger->log("Command", Log::DEBUG, "UNLOCK");
 }
 
-void Command::postMessageNoLock(Message* m)
+void Command::postMessageNoLock(Message* m) // FIXME - get rid of this if the sending-to-MessageQueue idea pans out
 {
   // As above but use this one if this message is being posted because of a button press
   // the mutex is already locked, locking around postMessage is not needed as the
@@ -369,11 +335,9 @@ bool Command::postMessageIfNotBusy(Message* m)
 {
   // Used for Windows mouse events
 
-  //logger->log("Command", Log::DEBUG, "TRY LOCK");
 #ifndef WIN32
   if (pthread_mutex_trylock(&masterLock) != EBUSY)
   {
-    //logger->log("Command", Log::DEBUG, "LOCK");
     MessageQueue::postMessage(m);
 #ifndef __ANDROID__
     kill(mainPid, SIGURG);
@@ -381,7 +345,6 @@ bool Command::postMessageIfNotBusy(Message* m)
     ((RemoteAndroid*)Remote::getInstance())->Signal();
 #endif
     pthread_mutex_unlock(&masterLock);
-    //logger->log("Command", Log::DEBUG, "UNLOCK");
     return true;
   }
   else
@@ -478,7 +441,7 @@ void Command::processMessage(Message* m)
 
       case Message::VDR_CONNECTED:
       {
-        doJustConnected((VConnect*)m->from);
+        doJustConnected(static_cast<VConnect*>(m->from));
         break;
       }
       case Message::SCREENSHOT:
@@ -527,22 +490,18 @@ void Command::processMessage(Message* m)
       }
       case Message::NEW_PICTURE:
       {
-    	  //Log::getInstance()->log("Command", Log::DEBUG, "TVMedia NEW_PICTURE");
-    	  OsdVector *osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
-    	  if (osdv) {
-    		  osdv->informPicture(m->tag,m->parameter.handle);
-    	  }
-
-      } break;
+        //Log::getInstance()->log("Command", Log::DEBUG, "TVMedia NEW_PICTURE");
+        OsdVector* osdv = dynamic_cast<OsdVector*>(Osd::getInstance());
+        if (osdv) osdv->informPicture(m->tag, m->parameter.handle);
+        break;
+      }
       case Message::NEW_PICTURE_STATIC:
       {
-    	  //Log::getInstance()->log("Command", Log::DEBUG, "TVMedia NEW_PICTURE %x %x",m->tag,m->parameter.num);
-    	  OsdVector *osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
-    	  if (osdv) {
-    		  osdv->informPicture(((unsigned long long)m->tag)<<32LL,m->parameter.handle);
-    	  }
-
-      } break;
+        //Log::getInstance()->log("Command", Log::DEBUG, "TVMedia NEW_PICTURE %x %x",m->tag,m->parameter.num);
+        OsdVector* osdv = dynamic_cast<OsdVector*>(Osd::getInstance());
+        if (osdv) osdv->informPicture(((unsigned long long)m->tag)<<32LL,m->parameter.handle);
+        break;
+      }
     }
   }
   else
@@ -563,7 +522,9 @@ void Command::processMessage(Message* m)
 void Command::handleCommand(int button)
 {
   if (isStandby && (button != Remote::POWER) 
-      && (button != Remote::POWERON) && (button != Remote::POWEROFF))  return;
+                && (button != Remote::POWERON)
+                && (button != Remote::POWEROFF))  return;
+
   if (!connLost && boxstack->handleCommand(button)) return; // don't send to boxstack if connLost
 
   // command was not handled
@@ -575,27 +536,34 @@ void Command::handleCommand(int button)
     case Remote::VOLUMEUP:
     case Remote::VOLUMEDOWN:
     {
-    	if (remote->handlesVolume()) {
-    		if (button==Remote::DF_LEFT || button==Remote::VOLUMEDOWN)
-    			remote->volumeDown();
-    		else remote->volumeUp();
-    	} else {
-    		VVolume* v = new VVolume();
-    		boxstack->add(v);
-    		v->handleCommand(button); // this will draw+show
-    	}
+      if (remote->handlesVolume())
+      {
+        if (button==Remote::DF_LEFT || button==Remote::VOLUMEDOWN)
+          remote->volumeDown();
+        else
+          remote->volumeUp();
+      }
+      else
+      {
+        VVolume* v = new VVolume();
+        boxstack->add(v);
+        v->handleCommand(button); // this will draw+show
+      }
       return;
     }
     case Remote::MUTE:
     {
-    	if (remote->handlesVolume()) {
-    		remote->volumeMute();
-    	} else {
-    		VMute* v = new VMute();
-    		v->draw();
-    		boxstack->add(v);
-    		boxstack->update(v);
-    	}
+      if (remote->handlesVolume())
+      {
+        remote->volumeMute();
+      }
+      else
+      {
+        VMute* v = new VMute();
+        v->draw();
+        boxstack->add(v);
+        boxstack->update(v);
+      }
       return;
     }
     case Remote::POWER:
@@ -648,7 +616,7 @@ void Command::doStandby()
   }
   else
   {
-   doPowerOff();
+    doPowerOff();
   }
 }
 
@@ -660,8 +628,7 @@ void Command::doPowerOn()
     Video::getInstance()->signalOn();
     Led::getInstance()->on();
     Remote::getInstance()->changePowerState(true);
-    isStandby = 0;
-
+    isStandby = false;
 
     VConnect* vconnect = new VConnect(server);
     boxstack->add(vconnect);
@@ -683,7 +650,7 @@ void Command::doPowerOff()
     VDR::getInstance()->disconnect();
     Led::getInstance()->off();
     Remote::getInstance()->changePowerState(false);
-    isStandby = 1;
+    isStandby = true;
     Sleeptimer::getInstance()->shutdown();
 #ifdef WIN32
     stop(); //different behavoiur on windows, we exit
@@ -798,44 +765,45 @@ void Command::buildCrashedBox()
   boxstack->update(crash);
 }
 
-int Command::getLangPref(bool subtitle,const char* langcode)
+int Command::getLangPref(bool subtitle, const char* langcode)
 {
-	vector<struct ASLPref>::iterator itty=langcodes.begin();
-	char templangcode[4];
-	templangcode[0]=langcode[0];
-	templangcode[1]=langcode[1];
-	templangcode[2]=langcode[2];
-	templangcode[3]='\0';
-	int langpos =0;
-	while (itty != langcodes.end()) {
-		size_t pos=(*itty).langcode.find(templangcode);
-		if (pos != string::npos) {
-			//vector<struct ASLPref>::iterator itty2=langcodes.begin();
-			for (unsigned int i=0; i<langcodes.size();i++) {
-				int pref=0;
-				if (subtitle) {
-					pref=langcodes[i].subtitlepref;
-				} else {
-					pref=langcodes[i].audiopref;
-				}
-				if (pref < 0) break;
-
-				if (subtitle) {
-					if (langcodes[i].subtitlepref==langpos) {
-						return i;
-					}
-				} else {
-					if (langcodes[i].audiopref==langpos) {
-						return i;
-					}
-				}
-			}
-			break;
-		}
-		itty++;
-		langpos++;
-	}
-	return langcodes.size(); //neutral
+  std::vector<struct ASLPref>::iterator itty=langcodes.begin();
+  char templangcode[4];
+  templangcode[0] = langcode[0];
+  templangcode[1] = langcode[1];
+  templangcode[2] = langcode[2];
+  templangcode[3] = '\0';
+  int langpos = 0;
+  while (itty != langcodes.end())
+  {
+    size_t pos = (*itty).langcode.find(templangcode);
+    if (pos != std::string::npos)
+    {
+      //vector<struct ASLPref>::iterator itty2=langcodes.begin();
+      for (unsigned int i = 0; i < langcodes.size(); i++)
+      {
+        int pref = 0;
+        if (subtitle)
+          pref = langcodes[i].subtitlepref;
+        else
+          pref = langcodes[i].audiopref;
+        if (pref < 0) break;
+
+        if (subtitle)
+        {
+          if (langcodes[i].subtitlepref==langpos) return i;
+        }
+        else
+        {
+          if (langcodes[i].audiopref==langpos) return i;
+        }
+      }
+      break;
+    }
+    itty++;
+    langpos++;
+  }
+  return langcodes.size(); //neutral
 }
 
 void Command::doJustConnected(VConnect* vconnect)
@@ -878,27 +846,33 @@ void Command::doJustConnected(VConnect* vconnect)
   if (config) delete[] config;
 
   config = vdr->configLoad("Advanced", "Skin Name");
-  if (config) {
-	  const char **skinnames=SkinFactory::getSkinNames();
-	  for (int i=0;i<SkinFactory::getNumberofSkins();i++) {
-		  if (!STRCASECMP(config, skinnames[i])) {
-			  SkinFactory::InitSkin(i);
-			  break;
-		  }
-	  }
-	  delete[] config;
-	  if (wallpaper && wallpaper_pict) {
-		  if (DrawStyle::WALLPAPER.alpha) {
-			  wallpaper_pict->setVisible(true);
-		  } else {
-			  wallpaper_pict->setVisible(false);
-		  }
-		  wallpaper->draw();
-		  boxstack->update(wallpaper);
-	  }
-
-  } else {
-	  SkinFactory::InitSkin(0);
+  if (config)
+  {
+    const char **skinnames=SkinFactory::getSkinNames();
+    for (int i=0;i<SkinFactory::getNumberofSkins();i++)
+    {
+      if (!STRCASECMP(config, skinnames[i]))
+      {
+        SkinFactory::InitSkin(i);
+        break;
+      }
+    }
+    delete[] config;
+
+    if (wallpaper && wallpaper_pict)
+    {
+      if (DrawStyle::WALLPAPER.alpha)
+        wallpaper_pict->setVisible(true);
+      else
+        wallpaper_pict->setVisible(false);
+
+      wallpaper->draw();
+      boxstack->update(wallpaper);
+    }
+  }
+  else
+  {
+    SkinFactory::InitSkin(0);
   }
 
   // See if config says to override video format (PAL/NTSC)
@@ -952,7 +926,7 @@ void Command::doJustConnected(VConnect* vconnect)
 
 #ifndef __ANDROID__
       //we do not init twice
-      osd->init((char*)("/dev/stbgfx"));
+      osd->init();
 #endif
 
       // Put the wallpaper back
@@ -985,7 +959,7 @@ void Command::doJustConnected(VConnect* vconnect)
   // Power off if first boot and config says so
   if (firstBoot)
   {
-    firstBoot = 0;
+    firstBoot = false;
 
     logger->log("Command", Log::DEBUG, "Load power after boot");
 
@@ -1198,29 +1172,27 @@ void Command::doJustConnected(VConnect* vconnect)
 
   // Set recording list type
 
-  advmenues=false;
-#ifdef	  ADVANCED_MENUES
+#ifdef ADVANCED_MENUES
   config = vdr->configLoad("Advanced", "Menu type");
 
   if (config)
   {
-	  if (!STRCASECMP(config, "Advanced"))
-	  {
-		  logger->log("Command", Log::INFO, "Switching to Advanced menu");
-		  advmenues=true;
-
-	  }
-	  else
-	  {
-		  logger->log("Command", Log::INFO, "Switching to Classic menu");
-		  advmenues=false;
-	  }
-	  delete[] config;
+    if (!STRCASECMP(config, "Advanced"))
+    {
+      logger->log("Command", Log::INFO, "Switching to Advanced menu");
+      advMenus = true;
+    }
+    else
+    {
+      logger->log("Command", Log::INFO, "Switching to Classic menu");
+      advMenus = false;
+    }
+    delete[] config;
   }
   else
   {
-	  logger->log("Command", Log::INFO, "Config General/menu type not found");
-	  advmenues=true;
+    logger->log("Command", Log::INFO, "Config General/menu type not found");
+    advMenus = true;
   }
 #endif
 
diff --git a/command.h b/command.h
index 04cd803..49bf40d 100644
--- a/command.h
+++ b/command.h
@@ -1,5 +1,5 @@
 /*
-    Copyright 2004-2005 Chris Tallon
+    Copyright 2004-2020 Chris Tallon
 
     This file is part of VOMP.
 
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #ifndef COMMAND_H
@@ -56,13 +55,7 @@ struct ASLPref {
 	int subtitlepref;
 };
 
-typedef vector<struct ASLPref> ASLPrefList;
-
-#define SIG_INT 1
-#define SIG_TERM 2
-#define SIG_USR1 4
-#define SIG_USR2 8
-#define SIG_URG 16
+typedef std::vector<struct ASLPref> ASLPrefList;
 
 class Command : public MessageQueue
 {
@@ -74,7 +67,6 @@ class Command : public MessageQueue
     int init(bool crashed = false, char* server = NULL);
     int shutdown();
     void run();
-    void stop();
     void doReboot();
     void postMessage(Message* m); // override of MessageQueue::postMessage
     void postMessageNoLock(Message* m); // override of MessageQueue::postMessage
@@ -83,14 +75,15 @@ class Command : public MessageQueue
     void setSignal(int signalReceived);
     void connectionLost();
 
-    void setAdvMenues(bool adv) {advmenues=adv;};
-    bool advMenues() { return advmenues;};
+    void setAdvMenus(bool adv) { advMenus = adv; };
+    bool isAdvMenus() { return advMenus; };
     int getLangPref(bool subtitle,const char* langcode);
     void setSubDefault(int subon) {subdefault=subon;};
     int getSubDefault() { return subdefault;};
     ASLPrefList &getASLList(){return langcodes;};
 
   private:
+    void stop();
     void handleCommand(int);
     void processSignals();
     void doStandby();
@@ -110,28 +103,35 @@ class Command : public MessageQueue
     HANDLE masterLock;
     HANDLE mainPid; //Window
 #endif
-    UCHAR initted;
-    UCHAR irun;
-    UCHAR isStandby;
-    UCHAR firstBoot;
-    ULONG signals;
+    bool initted{};
+    bool irun{};
+    bool isStandby{};
+    bool firstBoot{true};
+    int signals{};
 
     Log* logger;
     BoxStack* boxstack;
     Remote* remote;
-    Boxx* wallpaper;
-    WJpeg* wallpaper_pict;
-    VInfo* connLost;
-    bool crashed;
-    char* server;
+    Boxx* wallpaper{};
+    WJpeg* wallpaper_pict{};
+    VInfo* connLost{};
+    bool crashed{};
+    char* server{};
 
-    bool  advmenues;
+    bool advMenus{};
     ASLPrefList langcodes;
     int subdefault;
         
     UDP udp;
 
     void processMessage(Message* m);
+
+    const static int SIG_INT{1};
+    const static int SIG_TERM{2};
+    const static int SIG_USR1{4};
+    const static int SIG_USR2{8};
+    const static int SIG_URG{16};
+
 };
 
 #endif
diff --git a/defines.h b/defines.h
index 46e2519..16f14d4 100644
--- a/defines.h
+++ b/defines.h
@@ -116,7 +116,6 @@ int getClockRealTime(struct timespec *tp);
   //lirc?
    #define Led_TYPE LedRaspberry  //this is device dependent
    #define Osd_TYPE OsdOpenVG   // This OpenGL ES 2.0, in the moment only for raspberry, but might be splitted for other devices
-   #define OsdStartDev ""
    #define Audio_TYPE AudioOMX   // This is Audio based on OpenMax and libav for decoding
    #define Video_TYPE VideoOMX   // This is Video based on OpenMax
 
@@ -159,7 +158,6 @@ int getClockRealTime(struct timespec *tp);
   #define RemoteStartDev "/dev/rawir"
   #define Led_TYPE
   #define Osd_TYPE
-  #define OsdStartDev "/dev/stbgfx"
   #define Audio_TYPE
   #define Video_TYPE
   #define Surface_TYPE
@@ -181,7 +179,6 @@ int getClockRealTime(struct timespec *tp);
   #define RemoteStartDev "/dev/lircd"
   #define Led_TYPE LedMVP
   #define Osd_TYPE OsdDirectFB
-  #define OsdStartDev ""
   #define Audio_TYPE AudioNMT
   #define Video_TYPE VideoNMT
   #define Surface_TYPE SurfaceDirectFB //deprecated
diff --git a/directory.cc b/directory.cc
index 09b585b..3c7eec3 100644
--- a/directory.cc
+++ b/directory.cc
@@ -87,13 +87,13 @@ ULONG Directory::getNumNewRecordings()
 void Directory::sort(bool chronoSortOrder)
 {
   // Sort the directory order
-  ::sort(dirList.begin(), dirList.end(), DirectorySorter());
+  std::sort(dirList.begin(), dirList.end(), DirectorySorter());
 
   // Sort the recordings order
   if (chronoSortOrder)
-    ::sort(recList.begin(), recList.end(), RecordingSorterChrono());
+    std::sort(recList.begin(), recList.end(), RecordingSorterChrono());
   else
-    ::sort(recList.begin(), recList.end(), RecordingSorterAlpha());
+    std::sort(recList.begin(), recList.end(), RecordingSorterAlpha());
 
   // Now get the dirs to sort themselves! oh I love recursion.
   for(UINT i = 0; i < dirList.size(); i++) dirList[i]->sort(chronoSortOrder);
diff --git a/directory.h b/directory.h
index e37c59d..b08018d 100644
--- a/directory.h
+++ b/directory.h
@@ -24,14 +24,13 @@
 #include <stdio.h>
 #include <vector>
 #include <algorithm>
-using namespace std;
 
 #include "defines.h"
 #include "recording.h"
 
 class Directory;
-typedef vector<Directory*> DirectoryList;
-typedef vector<Recording*> RecordingList;
+typedef std::vector<Directory*> DirectoryList;
+typedef std::vector<Recording*> RecordingList;
 
 class Directory
 {
diff --git a/draintarget.h b/draintarget.h
index e3a8f2b..ee07b7f 100644
--- a/draintarget.h
+++ b/draintarget.h
@@ -51,8 +51,7 @@ struct MediaPacket
 #endif
 };
 
-using namespace std;
-typedef list<MediaPacket> MediaPacketList;
+typedef std::list<MediaPacket> MediaPacketList;
 
 
 
diff --git a/dsallocator.h b/dsallocator.h
index 645c3fb..acc73f8 100644
--- a/dsallocator.h
+++ b/dsallocator.h
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 #ifndef DSALLOCATOR_H
 #define DSALLOCATOR_H
@@ -23,9 +22,6 @@
 #include <queue>
 #include <vector>
 
-
-using namespace std;
-
 #include <winsock2.h>
 
 #include <d3d9.h>
@@ -38,44 +34,42 @@ using namespace std;
 //The Allocator and Presenter for VMR9 is also a Presnter for EVR
 
 class DsAllocator: public IVMRSurfaceAllocator9, IVMRImagePresenter9, Mutex,IMFVideoDeviceID, 
-	IMFTopologyServiceLookupClient,public IMFVideoPresenter,IMFGetService, IQualProp {
-public:
-	DsAllocator();
-	virtual ~DsAllocator();
-
-	virtual HRESULT STDMETHODCALLTYPE StartPresenting(DWORD_PTR userid);
-	virtual HRESULT STDMETHODCALLTYPE StopPresenting(DWORD_PTR userid);
-	virtual HRESULT STDMETHODCALLTYPE PresentImage(DWORD_PTR userid,VMR9PresentationInfo* presinf);
-
-	virtual HRESULT STDMETHODCALLTYPE InitializeDevice(DWORD_PTR userid,
-		VMR9AllocationInfo* allocinf,DWORD* numbuf);
-	virtual HRESULT STDMETHODCALLTYPE TerminateDevice(DWORD_PTR userid); 
-	virtual HRESULT STDMETHODCALLTYPE GetSurface(DWORD_PTR userid,DWORD surfindex,DWORD surfflags, IDirect3DSurface9** surf);
-	virtual HRESULT STDMETHODCALLTYPE AdviseNotify(IVMRSurfaceAllocatorNotify9* allnoty);
-	
-
-	virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID refiid,void ** obj);
-	virtual ULONG STDMETHODCALLTYPE AddRef();
-	virtual ULONG STDMETHODCALLTYPE Release();
+    IMFTopologyServiceLookupClient,public IMFVideoPresenter,IMFGetService, IQualProp {
+  public:
+    DsAllocator();
+    virtual ~DsAllocator();
+
+    virtual HRESULT STDMETHODCALLTYPE StartPresenting(DWORD_PTR userid);
+    virtual HRESULT STDMETHODCALLTYPE StopPresenting(DWORD_PTR userid);
+    virtual HRESULT STDMETHODCALLTYPE PresentImage(DWORD_PTR userid,VMR9PresentationInfo* presinf);
+
+    virtual HRESULT STDMETHODCALLTYPE InitializeDevice(DWORD_PTR userid, VMR9AllocationInfo* allocinf,DWORD* numbuf);
+    virtual HRESULT STDMETHODCALLTYPE TerminateDevice(DWORD_PTR userid);
+    virtual HRESULT STDMETHODCALLTYPE GetSurface(DWORD_PTR userid,DWORD surfindex,DWORD surfflags, IDirect3DSurface9** surf);
+    virtual HRESULT STDMETHODCALLTYPE AdviseNotify(IVMRSurfaceAllocatorNotify9* allnoty);
+
+    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID refiid,void ** obj);
+    virtual ULONG STDMETHODCALLTYPE AddRef();
+    virtual ULONG STDMETHODCALLTYPE Release();
 
     void LostDevice(IDirect3DDevice9 *d3ddev, IDirect3D9* d3d);
 
-	/* EVR members */
-	virtual HRESULT STDMETHODCALLTYPE GetDeviceID(IID *pDid);
+    /* EVR members */
+    virtual HRESULT STDMETHODCALLTYPE GetDeviceID(IID *pDid);
 
-	virtual HRESULT STDMETHODCALLTYPE InitServicePointers(IMFTopologyServiceLookup *plooky);
-	virtual HRESULT STDMETHODCALLTYPE ReleaseServicePointers();
+    virtual HRESULT STDMETHODCALLTYPE InitServicePointers(IMFTopologyServiceLookup *plooky);
+    virtual HRESULT STDMETHODCALLTYPE ReleaseServicePointers();
 
-	virtual HRESULT STDMETHODCALLTYPE ProcessMessage(MFVP_MESSAGE_TYPE mess,ULONG_PTR mess_para);
+    virtual HRESULT STDMETHODCALLTYPE ProcessMessage(MFVP_MESSAGE_TYPE mess,ULONG_PTR mess_para);
 
-	virtual HRESULT STDMETHODCALLTYPE OnClockStart(MFTIME systime,LONGLONG startoffset);
-	virtual HRESULT STDMETHODCALLTYPE OnClockStop(MFTIME systime);
-	virtual HRESULT STDMETHODCALLTYPE OnClockPause(MFTIME systime);
-	virtual HRESULT STDMETHODCALLTYPE OnClockRestart(MFTIME systime);
-	virtual HRESULT STDMETHODCALLTYPE OnClockSetRate(MFTIME systime,float rate);
-	virtual HRESULT STDMETHODCALLTYPE GetCurrentMediaType(IMFVideoMediaType **mtype);
+    virtual HRESULT STDMETHODCALLTYPE OnClockStart(MFTIME systime,LONGLONG startoffset);
+    virtual HRESULT STDMETHODCALLTYPE OnClockStop(MFTIME systime);
+    virtual HRESULT STDMETHODCALLTYPE OnClockPause(MFTIME systime);
+    virtual HRESULT STDMETHODCALLTYPE OnClockRestart(MFTIME systime);
+    virtual HRESULT STDMETHODCALLTYPE OnClockSetRate(MFTIME systime,float rate);
+    virtual HRESULT STDMETHODCALLTYPE GetCurrentMediaType(IMFVideoMediaType **mtype);
 
-	virtual HRESULT STDMETHODCALLTYPE GetService(const GUID &guid,const IID &iid,LPVOID *obj);
+    virtual HRESULT STDMETHODCALLTYPE GetService(const GUID &guid,const IID &iid,LPVOID *obj);
 
     virtual HRESULT STDMETHODCALLTYPE get_FramesDrawn(int *val);
     virtual HRESULT STDMETHODCALLTYPE get_AvgFrameRate(int *val);
@@ -84,61 +78,50 @@ public:
     virtual HRESULT STDMETHODCALLTYPE get_DevSyncOffset(int *val);
     virtual HRESULT STDMETHODCALLTYPE get_FramesDroppedInRenderer(int *val);
 
-	void GetNextSurface(LPDIRECT3DSURFACE9 *surf,DWORD *waittime);
-	void DiscardSurfaceandgetWait(DWORD *waittime);
-
+    void GetNextSurface(LPDIRECT3DSURFACE9 *surf,DWORD *waittime);
+    void DiscardSurfaceandgetWait(DWORD *waittime);
 
 protected:
 
-	void RenegotiateEVRMediaType();
-	void AllocateEVRSurfaces();
-	void FlushEVRSamples();
-	void GetEVRSamples();
-
-	void ResetSyncOffsets();
-	void CalcSyncOffsets(int sync);
-	void CalcJitter(int jitter);
-	
-	vector<IDirect3DSurface9*> surfaces;
-	queue<IMFSample*> emptyevrsamples;
-	queue<IMFSample*> fullevrsamples;
-	//CCritSec objCritSec;
-	IVMRSurfaceAllocatorNotify9* surfallocnotify;
-	void CleanupSurfaces();
-	LONG refcount;
-	DWORD vheight;
-	DWORD vwidth;
-	bool inevrmode;
-	bool endofstream;
+    void RenegotiateEVRMediaType();
+    void AllocateEVRSurfaces();
+    void FlushEVRSamples();
+    void GetEVRSamples();
+
+    void ResetSyncOffsets();
+    void CalcSyncOffsets(int sync);
+    void CalcJitter(int jitter);
+
+    std::vector<IDirect3DSurface9*> surfaces;
+    std::queue<IMFSample*> emptyevrsamples;
+    std::queue<IMFSample*> fullevrsamples;
+    //CCritSec objCritSec;
+    IVMRSurfaceAllocatorNotify9* surfallocnotify;
+    void CleanupSurfaces();
+    LONG refcount;
+    DWORD vheight;
+    DWORD vwidth;
+    bool inevrmode;
+    bool endofstream;
     bool start_get_evr_samples;
 
-	IMFTransform* mftransform;
-	IMediaEventSink* mediasink;
-	IMFClock* mfclock;
-	IMFMediaType *mfmediatype;
-
-	static const int n_stats=126;
-	int sync_offset[n_stats];
-	int jitter_offset[n_stats];
-	unsigned int sync_pos;
-	unsigned int jitter_pos;
-	int framesdrawn;
-	int framesdropped;
-	int avg_sync_offset;
-	int dev_sync_offset;
-	int jitter;
+    IMFTransform* mftransform;
+    IMediaEventSink* mediasink;
+    IMFClock* mfclock;
+    IMFMediaType *mfmediatype;
+
+    static const int n_stats=126;
+    int sync_offset[n_stats];
+    int jitter_offset[n_stats];
+    unsigned int sync_pos;
+    unsigned int jitter_pos;
+    int framesdrawn;
+    int framesdropped;
+    int avg_sync_offset;
+    int dev_sync_offset;
+    int jitter;
     int avgfps;
     LONGLONG lastdelframe;
-
-
-
 };
 
-
-
-
-
-
-
-
 #endif
diff --git a/eventdispatcher.h b/eventdispatcher.h
index 3471754..407e0b7 100644
--- a/eventdispatcher.h
+++ b/eventdispatcher.h
@@ -32,9 +32,6 @@
 
 #include "defines.h"
 
-using namespace std;
-
-
 class EDReceiver //(implementation in eventdispatcher.cc)
 {
   friend class EventDispatcher;
@@ -63,7 +60,7 @@ class EventDispatcher
 {
 
   public:
-    typedef list<EDReceiver*> EDRL;
+    typedef std::list<EDReceiver*> EDRL;
 
     EventDispatcher();
     virtual ~EventDispatcher() {};
diff --git a/i18n.cc b/i18n.cc
index cc2c6a0..0f14365 100644
--- a/i18n.cc
+++ b/i18n.cc
@@ -31,7 +31,6 @@
 #include "vdr.h"
 #include "log.h"
 
-using namespace std;
 I18n::trans_table I18n::Translations;
 
 int I18n::initialize(void)
@@ -39,7 +38,7 @@ int I18n::initialize(void)
   VDR *vdr = VDR::getInstance();
   char *lang = vdr->configLoad("General", "LangCode");
   lang_code_list list = vdr->getLanguageList();
-  string code;
+  std::string code;
   if (lang && list.count(lang) > 0)
     code = lang;
   else
@@ -61,7 +60,7 @@ int I18n::initialize(void)
 
 const char* I18n::translate(const char *s)
 {
-  string str = s;
+  std::string str = s;
   if (Translations.count(str) == 0) return s;
   return Translations[str].c_str();
   // This isn't ideal. A call to initialize() invalidates
diff --git a/imageomx.cc b/imageomx.cc
index 501542b..7e791bf 100644
--- a/imageomx.cc
+++ b/imageomx.cc
@@ -743,7 +743,7 @@ int ImageOMX::DestroyInputBufsOMXwhilePlaying() //call with clock mutex locked
 	while (input_bufs_omx_all.size()>0) {
 		if (input_bufs_omx_free.size()>0) {
 			// Destroy one buffer
-			vector<OMX_BUFFERHEADERTYPE*>::iterator itty=input_bufs_omx_all.begin();
+			std::vector<OMX_BUFFERHEADERTYPE*>::iterator itty=input_bufs_omx_all.begin();
 			OMX_BUFFERHEADERTYPE* cur_buf=input_bufs_omx_free.front();
 			for (; itty!= input_bufs_omx_all.end();itty++) {
 				if ((*itty)==cur_buf) {
diff --git a/imageomx.h b/imageomx.h
index 352856f..5a204e7 100644
--- a/imageomx.h
+++ b/imageomx.h
@@ -58,46 +58,46 @@ class ImageOMX : public OsdVector::PictureDecoder
   private:
 
     static OMX_ERRORTYPE EmptyBufferDone_OMX(OMX_IN OMX_HANDLETYPE hcomp,OMX_IN OMX_PTR appdata,OMX_IN OMX_BUFFERHEADERTYPE* bulibaver);
- 	static OMX_ERRORTYPE FillBufferDone_OMX(OMX_IN OMX_HANDLETYPE hcomp, OMX_IN OMX_PTR appdata,OMX_IN OMX_BUFFERHEADERTYPE* bulibaver);
+    static OMX_ERRORTYPE FillBufferDone_OMX(OMX_IN OMX_HANDLETYPE hcomp, OMX_IN OMX_PTR appdata,OMX_IN OMX_BUFFERHEADERTYPE* bulibaver);
 
 
- 	bool intDecodePicture(LoadIndex index, unsigned char * buffer, unsigned int length, EGLPictureCreator* egl_pict, VideoOMX *video);
+    bool intDecodePicture(LoadIndex index, unsigned char * buffer, unsigned int length, EGLPictureCreator* egl_pict, VideoOMX *video);
 
     void ReturnEmptyOMXBuffer(OMX_BUFFERHEADERTYPE* bulibaver);
     void ReturnFillOMXBuffer(OMX_BUFFERHEADERTYPE* buffer);
 
 
-	OMX_HANDLETYPE omx_imag_decode;
-	OMX_HANDLETYPE omx_egl_render;
+    OMX_HANDLETYPE omx_imag_decode;
+    OMX_HANDLETYPE omx_egl_render;
 
-	OMX_U32 omx_image_input_port;
-	OMX_U32 omx_image_output_port;
+    OMX_U32 omx_image_input_port;
+    OMX_U32 omx_image_output_port;
 
-	OMX_U32 omx_egl_input_port;
-	OMX_U32 omx_egl_output_port;
+    OMX_U32 omx_egl_input_port;
+    OMX_U32 omx_egl_output_port;
 
 
-	int AllocateCodecsOMX( unsigned char * buffer, unsigned int length);
-	int DeAllocateCodecsOMX();
+    int AllocateCodecsOMX( unsigned char * buffer, unsigned int length);
+    int DeAllocateCodecsOMX();
 
-	int PrepareInputBufsOMX(bool setportdef, unsigned char * buffer, unsigned int length);
-	int DestroyInputBufsOMX();
-	int DestroyInputBufsOMXwhilePlaying();
+    int PrepareInputBufsOMX(bool setportdef, unsigned char * buffer, unsigned int length);
+    int DestroyInputBufsOMX();
+    int DestroyInputBufsOMXwhilePlaying();
 
-	enum ImageFormats {
-		Unsupported,
-		Jpeg,
-		PNG
-	};
+    enum ImageFormats {
+        Unsupported,
+        Jpeg,
+        PNG
+    };
 
-	enum ImageFormats curformat;
+    enum ImageFormats curformat;
 
 
 
-	vector<OMX_BUFFERHEADERTYPE*> input_bufs_omx_all;
-	list<OMX_BUFFERHEADERTYPE*> input_bufs_omx_free;
-	//list<OMX_BUFFERHEADERTYPE*> output_bufs_omx_full;
-	Mutex input_bufs_omx_mutex;
+    std::vector<OMX_BUFFERHEADERTYPE*> input_bufs_omx_all;
+    std::list<OMX_BUFFERHEADERTYPE*> input_bufs_omx_free;
+    //list<OMX_BUFFERHEADERTYPE*> output_bufs_omx_full;
+    Mutex input_bufs_omx_mutex;
 
     bool omx_running;
     bool omx_first_frame;
@@ -111,8 +111,8 @@ class ImageOMX : public OsdVector::PictureDecoder
     char L_VPE_OMX_EGL_REND[128];
 
   protected:
-      OsdVector::PictureInfo pictInf;
-  	  bool pictInfValid;
+    OsdVector::PictureInfo pictInf;
+    bool pictInfValid;
 
 };
 
diff --git a/main.cc b/main.cc
index 9b0fff6..1c1a7ab 100644
--- a/main.cc
+++ b/main.cc
@@ -287,7 +287,7 @@ int main(int argc, char** argv)
     shutdown(1);
   }
 
-  success = osd->init((void*)OsdStartDev);
+  success = osd->init();
   if (success)
   {
     logger->log("Core", Log::INFO, "OSD module initialised");
diff --git a/mark.h b/mark.h
index 6139a17..f4c0923 100644
--- a/mark.h
+++ b/mark.h
@@ -26,8 +26,6 @@
 
 #include "defines.h"
 
-using namespace std;
-
 class Mark
 {
   public:
@@ -36,6 +34,6 @@ class Mark
     int pos;
 };
 
-typedef vector<Mark*> MarkList;
+typedef std::vector<Mark*> MarkList;
 
 #endif
diff --git a/media.h b/media.h
index 7ad0522..4681bbe 100644
--- a/media.h
+++ b/media.h
@@ -22,10 +22,10 @@
 #define MEDIA_H
 
 
-#include <vector>
-using namespace std;
 #include <stdio.h>
 #include <string.h>
+#include <vector>
+
 #include "defines.h"
 #include "serialize.h"
 
@@ -204,7 +204,7 @@ class Media : public Serializable
 };
 
 
-typedef vector<Media*> MediaListI;
+typedef std::vector<Media*> MediaListI;
 
 /**
   * the MediaList - containing a root URI and
diff --git a/mediaoptions.h b/mediaoptions.h
index 9e04bc6..f2ad8cb 100644
--- a/mediaoptions.h
+++ b/mediaoptions.h
@@ -28,7 +28,6 @@
 #include "log.h"
 #include "abstractoption.h"
 
-using namespace std;
 class WTabBar;
 class VDR;
 class Option;
@@ -51,7 +50,7 @@ class MediaOptions: AbstractOption
     bool setIntOption(const char * name, UINT value) ;
   private:
     bool saveOption(Option *option);
-    vector<Option*> myOptions;
+    std::vector<Option*> myOptions;
     Option * findOption(const char* name);
     static MediaOptions * instance;
     WOptionPane *pane;
diff --git a/mediaplayer.h b/mediaplayer.h
index ada5c97..f39f7aa 100644
--- a/mediaplayer.h
+++ b/mediaplayer.h
@@ -23,7 +23,6 @@
 
 
 #include <vector>
-using namespace std;
 #include <stdio.h>
 #include <string.h>
 #include "mediaprovider.h"
@@ -99,7 +98,7 @@ class MediaPlayer : public MediaPlayerRegister, public MediaProvider
 
   private:
     MediaProvider * providerById(ULONG id);
-    typedef vector<MediaProviderHolder *> Tplist;
+    typedef std::vector<MediaProviderHolder *> Tplist;
     Tplist plist;
     struct channelInfo {
       ULONG providerId;
diff --git a/messagequeue.cc b/messagequeue.cc
index 0a0a906..6f7a44b 100644
--- a/messagequeue.cc
+++ b/messagequeue.cc
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #include "messagequeue.h"
@@ -23,10 +22,17 @@
 #include "message.h"
 #include "log.h"
 
+MessageQueue* MessageQueue::instance{};
+
+MessageQueue::MessageQueue() { instance = this; }
+
+MessageQueue::~MessageQueue() { instance = NULL; }
+
+MessageQueue* MessageQueue::getInstance() { return instance; }
+
 void MessageQueue::postMessage(Message* m)
 {
   messages.push(m);
-//  Log::getInstance()->log("MessageQueue", Log::DEBUG, "have stored message %lu in queue", m->message);
 }
 
 void MessageQueue::processMessageQueue()
@@ -36,7 +42,6 @@ void MessageQueue::processMessageQueue()
   {
     m = messages.front();
     messages.pop();
-//    Log::getInstance()->log("MessageQueue", Log::DEBUG, "retrieved message from queue");
     processMessage(m);
     delete m;
   }
diff --git a/messagequeue.h b/messagequeue.h
index 9544645..e56f8ff 100644
--- a/messagequeue.h
+++ b/messagequeue.h
@@ -14,25 +14,25 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #ifndef MESSAGEQUEUE_H
 #define MESSAGEQUEUE_H
 
 #include <queue>
-using namespace std;
 
 class Message;
 
-typedef queue<Message*> MQueue;
+typedef std::queue<Message*> MQueue;
 
 class MessageQueue
 {
   public:
-    MessageQueue() {};
-    virtual ~MessageQueue() {};
+    MessageQueue();
+    virtual ~MessageQueue();
+
+    static MessageQueue* getInstance();
 
     virtual void postMessage(Message* m);
     virtual void postMessageNoLock(Message* m)=0;
@@ -44,6 +44,8 @@ class MessageQueue
     virtual void processMessage(Message* m)=0;
 
   private:
+    static MessageQueue* instance;
+
     MQueue messages;
 
 };
diff --git a/option.h b/option.h
index b4bd3f6..130f3be 100644
--- a/option.h
+++ b/option.h
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #ifndef OPTION_H
@@ -29,8 +28,7 @@ class AbstractOption;
 #include <vector>
 
 class Option;
-using namespace std;
-typedef vector<Option*> Options;
+typedef std::vector<Option*> Options;
 
 class Option
 {
diff --git a/osd.h b/osd.h
index a3cfef3..aef86fa 100644
--- a/osd.h
+++ b/osd.h
@@ -29,7 +29,7 @@ class Osd
     virtual ~Osd();
     static Osd* getInstance();
 
-    virtual int init(void* device)=0;
+    virtual int init()=0;
     virtual int shutdown()=0;
     virtual int restore() { return 1; };
     virtual int stopUpdate() { return 1; };
diff --git a/osddirectfb.cc b/osddirectfb.cc
index 8273643..844288c 100644
--- a/osddirectfb.cc
+++ b/osddirectfb.cc
@@ -45,7 +45,7 @@ int OsdDirectFB::getFD()
   return 0;
 }
 
-int OsdDirectFB::init(void* device)
+int OsdDirectFB::init()
 {
 
   if (initted) return 0;
diff --git a/osddirectfb.h b/osddirectfb.h
index 0b555b3..dcdafed 100644
--- a/osddirectfb.h
+++ b/osddirectfb.h
@@ -39,7 +39,7 @@ class OsdDirectFB : public Osd
     OsdDirectFB();
     ~OsdDirectFB();
 
-    int init(void* device);
+    int init();
     int shutdown();
 
     int getFD();
diff --git a/osdopengl.cc b/osdopengl.cc
index 61aa6b0..8e22988 100644
--- a/osdopengl.cc
+++ b/osdopengl.cc
@@ -70,13 +70,10 @@ Surface * OsdOpenGL::createNewSurface() {
 	return (Surface*)new SurfaceOpenGL();
 }
 
-int OsdOpenGL::init(void* device)
+int OsdOpenGL::init()
 {
   if (initted) return 0;
   Video* video = Video::getInstance();
-   //window=*((HWND*)device);
-  
-   // May be this device specific part should go to a device specific child class
 
    //init broadcom chipset (Move to video?)
 
diff --git a/osdopengl.h b/osdopengl.h
index 853c334..aa078df 100644
--- a/osdopengl.h
+++ b/osdopengl.h
@@ -71,7 +71,7 @@ class OsdOpenGL : public Osd, public Thread_TYPE
     OsdOpenGL();
     virtual ~OsdOpenGL();
 
-    int init(void* device);
+    int init();
     int shutdown();
 
     int getFD();
diff --git a/osdopenvg.cc b/osdopenvg.cc
index 3450472..e511ebf 100644
--- a/osdopenvg.cc
+++ b/osdopenvg.cc
@@ -92,7 +92,7 @@ OsdOpenVG::~OsdOpenVG()
   // pointed at anyway, so it's correctly not working?!
 
   if (!fontnames.size()) {
-	  vector<char*>::iterator itty=fontnames.begin();
+	  std::vector<char*>::iterator itty=fontnames.begin();
 	  while (itty!=fontnames.end()) {
 		  free((void*)*itty);
 
@@ -105,7 +105,7 @@ OsdOpenVG::~OsdOpenVG()
 
 
   if (fontnames_keys.size()) {
-  	  vector<char*>::iterator itty=fontnames_keys.begin();
+  	  std::vector<char*>::iterator itty=fontnames_keys.begin();
   	  while (itty!=fontnames_keys.end()) {
   		  free((void*)*itty);
   		  itty++;
@@ -118,14 +118,10 @@ OsdOpenVG::~OsdOpenVG()
 
 
 
-int OsdOpenVG::init(void* device)
+int OsdOpenVG::init()
 {
   if (initted) return 0;
   reader.init();
-  //Video* video = Video::getInstance();
-   //window=*((HWND*)device);
-
-   // May be this device specific part should go to a device specific child class
 
    //init broadcom chipset (Move to video?)
 
@@ -773,8 +769,8 @@ int  OsdOpenVG::loadFont(bool newfont)
 	FT_UInt glyph;
 	font_height=ft_face->size->metrics.height/256.f;
 	cur_char = FT_Get_First_Char(ft_face,&glyph);
-	vector<VGubyte> segments;
-	vector<VGfloat> coord;
+	std::vector<VGubyte> segments;
+	std::vector<VGfloat> coord;
 	segments.reserve(256);
 	coord.reserve(1024);
 	//Log::getInstance()->log("OSD", Log::DEBUG, "Create Glyph test %d %x %x %d",cur_char,font_data_end,font_data,glyph);
@@ -1391,7 +1387,7 @@ bool OsdOpenVG::haveOpenVGResponse(unsigned int id,unsigned int * resp)
 	taskmutex.Lock();
 	if (vgresponses.size()>0)
 	{
-		deque<OpenVGResponse>::iterator itty=vgresponses.begin();
+		std::deque<OpenVGResponse>::iterator itty=vgresponses.begin();
 		while (itty!=vgresponses.end())
 		{
 			if ((*itty).id==id) {
diff --git a/osdopenvg.h b/osdopenvg.h
index c462e14..a0b0cc7 100644
--- a/osdopenvg.h
+++ b/osdopenvg.h
@@ -86,7 +86,7 @@ class OsdOpenVG : public OsdVector, public Thread_TYPE
     OsdOpenVG();
     virtual ~OsdOpenVG();
 
-    int init(void* device);
+    int init();
     int shutdown();
     int stopUpdate();
 
@@ -117,28 +117,28 @@ protected:
     ImageIndex createMonoBitmap(void *base,int width,int height);
     ImageIndex createImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data);
     void createPicture(struct PictureInfo& pict_inf);
-	void destroyStyleRef(VectorHandle index);
-	VectorHandle createStyleRef(const DrawStyle &c);
-	bool getStaticImageData(unsigned int static_id, UCHAR **userdata, ULONG *length);
+    void destroyStyleRef(VectorHandle index);
+    VectorHandle createStyleRef(const DrawStyle &c);
+    bool getStaticImageData(unsigned int static_id, UCHAR **userdata, ULONG *length);
 
-	void drawSetTrans(SurfaceCommands & sc);
-	void executeDrawCommand(SVGCommand & command);
+    void drawSetTrans(SurfaceCommands & sc);
+    void executeDrawCommand(SVGCommand & command);
 
-	void initPaths();
-	void destroyPaths();
-	VGPath std_paths[PIPoint+1];
-	long long  lastrendertime;
-	void InternalRendering();
-	void getScreenSize(int &width, int &height);
-	void getRealScreenSize(int &width, int &height);
+    void initPaths();
+    void destroyPaths();
+    VGPath std_paths[PIPoint+1];
+    long long  lastrendertime;
+    void InternalRendering();
+    void getScreenSize(int &width, int &height);
+    void getRealScreenSize(int &width, int &height);
 
 
 
-	Mutex vgmutex;
-	Mutex taskmutex;
-	Signal vgtaskSignal;
-    deque<OpenVGCommand> vgcommands;
-    deque<OpenVGResponse> vgresponses;
+    Mutex vgmutex;
+    Mutex taskmutex;
+    Signal vgtaskSignal;
+    std::deque<OpenVGCommand> vgcommands;
+    std::deque<OpenVGResponse> vgresponses;
     bool processTasks();
     bool haveOpenVGResponse(unsigned int id,unsigned int * resp);
     unsigned int  putOpenVGCommand(OpenVGCommand& comm,bool wait);
@@ -151,34 +151,32 @@ protected:
     VGFont vgfont;
     VGFont vgttfont;
     VGPaint vgttpaint;
-    int  loadFont(bool fontchange);
-    map<unsigned int,float> font_exp_x;
-    vector<char*> fontnames;
-    vector<char*> fontnames_keys;
-    char * cur_fontname;
+    int loadFont(bool fontchange);
+    std::map<unsigned int,float> font_exp_x;
+    std::vector<char*> fontnames;
+    std::vector<char*> fontnames_keys;
+    char* cur_fontname;
 
     int clip_shift_x;
     int clip_shift_y;
 
     unsigned int loadTTchar(cTeletextChar c);
-    map<unsigned int,int> tt_font_chars;
+    std::map<unsigned int,int> tt_font_chars;
 
 
-
-	void threadMethod();
+    void threadMethod();
     void threadPostStopCleanup();
 
-
-	 /* BCM specific */
+    /* BCM specific */
 
     uint32_t display_height;
-	uint32_t display_width;
-	DISPMANX_DISPLAY_HANDLE_T bcm_display;
-	DISPMANX_ELEMENT_HANDLE_T bcm_element;
-	DISPMANX_ELEMENT_HANDLE_T bcm_background;
-	DISPMANX_RESOURCE_HANDLE_T bcm_backres;
+    uint32_t display_width;
+    DISPMANX_DISPLAY_HANDLE_T bcm_display;
+    DISPMANX_ELEMENT_HANDLE_T bcm_element;
+    DISPMANX_ELEMENT_HANDLE_T bcm_background;
+    DISPMANX_RESOURCE_HANDLE_T bcm_backres;
 
-	uint32_t mode;
+    uint32_t mode;
 
 
 	EGLDisplay egl_display;
diff --git a/osdvector.cc b/osdvector.cc
index 0ecc7e1..0ee1c5f 100644
--- a/osdvector.cc
+++ b/osdvector.cc
@@ -172,7 +172,7 @@ int OsdVector::restore()
 	surfaces_mutex.Lock();
 
 	//Now go through all surfaces and draw them
-	list<SurfaceCommands>::iterator curdraw=scommands.begin();
+	std::list<SurfaceCommands>::iterator curdraw=scommands.begin();
 	while (curdraw!=scommands.end()) {
 		(*curdraw).commands.clear();
 		(*curdraw).commands.reserve(2048);
@@ -200,10 +200,10 @@ int OsdVector::restore()
 void OsdVector::drawSurfaces()
 {
 	surfaces_mutex.Lock();
-	list<SurfaceCommands*> todraw; //First figure out if a surfaces is below another surface
-	list<SurfaceCommands>::iterator itty1=scommands.begin();
+	std::list<SurfaceCommands*> todraw; //First figure out if a surfaces is below another surface
+	std::list<SurfaceCommands>::iterator itty1=scommands.begin();
 	while (itty1!=scommands.end()) {
-		list<SurfaceCommands>::iterator itty2=itty1;
+		std::list<SurfaceCommands>::iterator itty2=itty1;
 		itty2++;
 		bool hidden=false;
 		while (itty2!=scommands.end()) {
@@ -225,7 +225,7 @@ void OsdVector::drawSurfaces()
 	int swidth,sheight;
 	getScreenSize(swidth,sheight);
 	//Now go through all surfaces and draw them
-	list<SurfaceCommands*>::iterator curdraw=todraw.begin();
+	std::list<SurfaceCommands*>::iterator curdraw=todraw.begin();
 	while (curdraw!=todraw.end()) {
 		drawSetTrans(*(*curdraw));
 		std::vector<SVGCommand>::iterator commands=(*(*curdraw)).commands.begin();
@@ -259,7 +259,7 @@ void OsdVector::updateOrAddSurface(const SurfaceVector *surf,float x,float y,flo
 {
 	surfaces_mutex.Lock();
 	//First determine it is already in our system
-	list<SurfaceCommands>::iterator itty=scommands.begin();
+	std::list<SurfaceCommands>::iterator itty=scommands.begin();
 	while (itty!=scommands.end()) {
 		if ((*itty).surf==surf) {
 			//decrease the references
@@ -311,7 +311,7 @@ void OsdVector::removeSurface(const SurfaceVector *surf)
 {
 	surfaces_mutex.Lock();
 	//First determine it is already in our system
-	list<SurfaceCommands>::iterator itty=scommands.begin();
+	std::list<SurfaceCommands>::iterator itty=scommands.begin();
 	while (itty!=scommands.end()) {
 		if ((*itty).surf==surf) {
 			dereferenceSVGCommand((*itty).commands);
@@ -393,7 +393,7 @@ void OsdVector::removeLoadIndexRef(const LoadIndex ref)
 	loadindex_ref[ref]--;
 	if (loadindex_ref[ref]==0) {
 		//now check, if it is already loaded
-		map<LoadIndex,ImageIndex>::iterator itty=tvmedias_loaded.find(ref);
+		std::map<LoadIndex,ImageIndex>::iterator itty=tvmedias_loaded.find(ref);
 		if ( itty != tvmedias_loaded.end()) {
 			removeImageRef((*itty).second); // remove lock
 		}
@@ -413,9 +413,9 @@ void OsdVector::removeLoadIndexRef(const LoadIndex ref)
 void OsdVector::cleanupOrphanedRefs()
 { // Do some garbage collection
 
-	map<void *,ImageIndex>::iterator mitty=monobitmaps.begin();
+	std::map<void *,ImageIndex>::iterator mitty=monobitmaps.begin();
 	while (mitty!=monobitmaps.end()) {
-		map<ImageIndex,int>::iterator curitty=images_ref.find((*mitty).second);
+		std::map<ImageIndex,int>::iterator curitty=images_ref.find((*mitty).second);
 		int count=(*curitty).second;
 		if (count==0) {
 			ImageIndex ref=(*curitty).first;
@@ -437,9 +437,9 @@ void OsdVector::cleanupOrphanedRefs()
 		} else ++jitty;
 	}*/
 
-	map<TVMediaInfo,ImageIndex>::iterator titty=tvmedias.begin();
+	std::map<TVMediaInfo,ImageIndex>::iterator titty=tvmedias.begin();
 	while (titty!=tvmedias.end()) {
-		map<ImageIndex,int>::iterator curitty=images_ref.find((*titty).second);
+		std::map<ImageIndex,int>::iterator curitty=images_ref.find((*titty).second);
 		int count=(*curitty).second;
 		if (count==0) {
 			ImageIndex ref=(*curitty).first;
@@ -450,9 +450,9 @@ void OsdVector::cleanupOrphanedRefs()
 	}
 
 
-	map<TVMediaInfo,LoadIndex>::iterator litty=tvmedias_load.begin();
+	std::map<TVMediaInfo,LoadIndex>::iterator litty=tvmedias_load.begin();
 	while (litty!=tvmedias_load.end()) {
-		map<LoadIndex,int>::iterator curitty=loadindex_ref.find((*litty).second);
+		std::map<LoadIndex,int>::iterator curitty=loadindex_ref.find((*litty).second);
 		int count=(*curitty).second;
 		if (count==0) {
 			tvmedias_load_inv.erase((*litty).second);
@@ -461,9 +461,9 @@ void OsdVector::cleanupOrphanedRefs()
 		} else ++litty;
 	}
 
-	list<ImageIndex>::iterator pitty=palettepics.begin();
+	std::list<ImageIndex>::iterator pitty=palettepics.begin();
 	while (pitty!=palettepics.end()) {
-		map<ImageIndex,int>::iterator curitty=images_ref.find((*pitty));
+		std::map<ImageIndex,int>::iterator curitty=images_ref.find((*pitty));
 		int count=(*curitty).second;
 		if (count==0) {
 			ImageIndex ref=(*curitty).first;
@@ -473,7 +473,7 @@ void OsdVector::cleanupOrphanedRefs()
 		} else ++pitty;
 	}
 
-	map<ImageIndex,int>::iterator citty=images_ref.begin();
+	std::map<ImageIndex,int>::iterator citty=images_ref.begin();
 	while (citty!=images_ref.end()) {
 		int count=(*citty).second;
 		if (count==0) {
@@ -484,9 +484,9 @@ void OsdVector::cleanupOrphanedRefs()
 	}
 
 
-	map<DrawStyle, VectorHandle>::iterator sitty = styles.begin();
+	std::map<DrawStyle, VectorHandle>::iterator sitty = styles.begin();
 	while (sitty!=styles.end()) {
-		map<VectorHandle, int>::iterator curitty = styles_ref.find((*sitty).second);
+		std::map<VectorHandle, int>::iterator curitty = styles_ref.find((*sitty).second);
 		int count=(*curitty).second;
 		if (count==0) {
 			VectorHandle ref = (*curitty).first;
@@ -667,7 +667,7 @@ void OsdVector::informPicture(LoadIndex index, ImageIndex imageIndex)
 	surfaces_mutex.Lock();
 	TVMediaInfo tvmedia=tvmedias_load_inv[index];
 	if (imageIndex) {
-		map<LoadIndex,int>::iterator itty=loadindex_ref.find(index);
+		std::map<LoadIndex,int>::iterator itty=loadindex_ref.find(index);
 		image_index=tvmedias[tvmedia]=imageIndex;
 		tvmedias_loaded[index]=image_index;
 
@@ -896,7 +896,7 @@ bool OsdVector::PictureReader::processReceivedPictures()
     if (pict_incoming.size()) {
 		VDR_ResponsePacket *vresp=pict_incoming.front();
 		pict_incoming.pop();
-		set<LoadIndex>::iterator setpos = invalid_loadindex.find(vresp->getStreamID());
+		std::set<LoadIndex>::iterator setpos = invalid_loadindex.find(vresp->getStreamID());
 		if (setpos != invalid_loadindex.end()) {
 			valid = false;
 			invalid_loadindex.erase(setpos);
@@ -954,7 +954,7 @@ bool OsdVector::PictureReader::processReceivedPictures()
 	} else if (pict_incoming_static.size()){
 		unsigned int static_id = pict_incoming_static.front();
 		pict_incoming_static.pop();
-		set<LoadIndex>::iterator setpos = invalid_loadindex.find(((long long) static_id) << 32LL);
+		std::set<LoadIndex>::iterator setpos = invalid_loadindex.find(((long long) static_id) << 32LL);
 		if (setpos != invalid_loadindex.end()) {
 			valid = false;
 			invalid_loadindex.erase(setpos);
diff --git a/osdvector.h b/osdvector.h
index 0628e08..3f2a8bb 100644
--- a/osdvector.h
+++ b/osdvector.h
@@ -197,7 +197,7 @@ class VDR_ResponsePacket;
 
 struct SurfaceCommands{
 	const SurfaceVector* surf;
-	vector<SVGCommand> commands;
+	std::vector<SVGCommand> commands;
 	float x,y,w,h;
 };
 
@@ -332,7 +332,7 @@ class OsdVector : public Osd
     	std::queue<unsigned int> pict_incoming_static;
     	std::list<PictureDecoder*> decoders;
     	std::map<LoadIndex,int> inform_fallback;
-    	set<LoadIndex> invalid_loadindex;
+    	std::set<LoadIndex> invalid_loadindex;
 
     	bool picture_update;
 
@@ -362,18 +362,18 @@ protected:
 
 
 
-	map<ImageIndex,int> images_ref;
-	map<void *,ImageIndex> monobitmaps;
+	std::map<ImageIndex,int> images_ref;
+	std::map<void *,ImageIndex> monobitmaps;
 	//map<string,ImageIndex> jpegs;
-	map<TVMediaInfo,ImageIndex> tvmedias;
-	list<ImageIndex> palettepics;
+	std::map<TVMediaInfo,ImageIndex> tvmedias;
+	std::list<ImageIndex> palettepics;
 
 
 
-	map<LoadIndex,int> loadindex_ref;
-	map<TVMediaInfo,LoadIndex> tvmedias_load;
-	map<LoadIndex,TVMediaInfo> tvmedias_load_inv;
-	map<LoadIndex,ImageIndex> tvmedias_loaded;
+	std::map<LoadIndex,int> loadindex_ref;
+	std::map<TVMediaInfo,LoadIndex> tvmedias_load;
+	std::map<LoadIndex,TVMediaInfo> tvmedias_load_inv;
+	std::map<LoadIndex,ImageIndex> tvmedias_loaded;
 
 
 
@@ -382,11 +382,11 @@ protected:
 	virtual void destroyStyleRef(VectorHandle index) = 0;
 
 
-	map<DrawStyle, VectorHandle> styles;
-	map<VectorHandle, int> styles_ref;
-	map<DrawStyle, VectorHandle>::iterator styles_lastit;
+	std::map<DrawStyle, VectorHandle> styles;
+	std::map<VectorHandle, int> styles_ref;
+	std::map<DrawStyle, VectorHandle>::iterator styles_lastit;
 	bool styles_lastit_valid;
-	map<VectorHandle, int>::iterator styles_ref_lastit;
+	std::map<VectorHandle, int>::iterator styles_ref_lastit;
 	bool styles_ref_lastit_valid;
 
 	virtual VectorHandle createStyleRef(const DrawStyle &c) = 0;
@@ -401,8 +401,6 @@ protected:
 	virtual void executeDrawCommand(SVGCommand & command)=0;
 
 
-
-
 	std::list<SurfaceCommands> scommands;
 
 	Mutex surfaces_mutex;
@@ -412,7 +410,4 @@ protected:
 	void drawSurfaces();
 };
 
-
-
-
 #endif
diff --git a/osdwinpixel.cc b/osdwinpixel.cc
index 87314bf..a64d34d 100644
--- a/osdwinpixel.cc
+++ b/osdwinpixel.cc
@@ -58,7 +58,7 @@ Surface * OsdWinPixel::createNewSurface(){
 	return (Surface*)new SurfaceWin();
 }
 
-int OsdWinPixel::init(void* device)
+int OsdWinPixel::init()
 {
   if (initted) return 0;
 
diff --git a/osdwinpixel.h b/osdwinpixel.h
index 863813c..a9e4143 100644
--- a/osdwinpixel.h
+++ b/osdwinpixel.h
@@ -36,7 +36,7 @@ class OsdWinPixel : public Osd, public WindowsOsd
     OsdWinPixel();
     ~OsdWinPixel();
 
-    int init(void* device);
+    int init();
     int shutdown();
 
 	int isInitialized() { return initted; }
diff --git a/osdwinvector.cc b/osdwinvector.cc
index 8ad49bc..75ae7dd 100644
--- a/osdwinvector.cc
+++ b/osdwinvector.cc
@@ -265,7 +265,7 @@ OsdWinVector::~OsdWinVector()
 
 
 
-int OsdWinVector::init(void* device)
+int OsdWinVector::init()
 {
   if (initted) return 0;
   reader.init();
diff --git a/osdwinvector.h b/osdwinvector.h
index a4b49fb..7957975 100644
--- a/osdwinvector.h
+++ b/osdwinvector.h
@@ -44,7 +44,7 @@ class OsdWinVector : public OsdVector, public WindowsOsd
     OsdWinVector();
     ~OsdWinVector();
 
-    int init(void* device);
+    int init();
     int shutdown();
 
 	int isInitialized() { return initted; }
diff --git a/playerliveradio.h b/playerliveradio.h
index 4c5b783..c5cd47d 100644
--- a/playerliveradio.h
+++ b/playerliveradio.h
@@ -98,11 +98,11 @@ class PlayerLiveRadio : public PlayerLive, public Thread_TYPE, public Callback,
     AFeed afeed;
     ChannelList* chanList;
 
-    queue<PLInstruction> instructions;
+    std::queue<PLInstruction> instructions;
     const static UCHAR I_SETCHANNEL = 1;
     const static UCHAR I_STOP = 2;
     
-    queue<StreamChunk> streamChunks;
+    std::queue<StreamChunk> streamChunks;
     
     bool initted;
 
diff --git a/playerlivetv.h b/playerlivetv.h
index 49bc9fe..cff36b5 100644
--- a/playerlivetv.h
+++ b/playerlivetv.h
@@ -118,11 +118,11 @@ class PlayerLiveTV : public PlayerLive, public Thread_TYPE, public Callback, pub
     TFeed tfeed;
     ChannelList* chanList;
 
-    queue<PLInstruction> instructions;
+    std::queue<PLInstruction> instructions;
     const static UCHAR I_SETCHANNEL = 1;
     const static UCHAR I_STOP = 2;
     
-    queue<StreamChunk> streamChunks;
+    std::queue<StreamChunk> streamChunks;
     
     bool initted;
 
diff --git a/recman.cc b/recman.cc
index 8691cc8..2bc05a4 100644
--- a/recman.cc
+++ b/recman.cc
@@ -58,7 +58,7 @@ void RecMan::addEntry(bool isNew, ULONG startTime, char* name, char* fileName)
 
   char* c;
   char* d;
-  stack<char*> dirNamesStack;
+  std::stack<char*> dirNamesStack;
   char* oneDirName;
   bool gotProgName = false;
   for(c = (name + strlen(name) - 1); c >= name; c--)
diff --git a/remote.h b/remote.h
index 61c2892..cccfb64 100644
--- a/remote.h
+++ b/remote.h
@@ -27,8 +27,7 @@
 #include "abstractoption.h"
 
 
-using namespace std;
-typedef map<ULLONG,UCHAR> RemoteTranslationList;
+typedef std::map<ULLONG,UCHAR> RemoteTranslationList;
 
 class Remote: public AbstractOption
 {
diff --git a/remotelinux.cc b/remotelinux.cc
index c912071..0ff0916 100644
--- a/remotelinux.cc
+++ b/remotelinux.cc
@@ -37,15 +37,12 @@
 
 #include <bcm_host.h>
 
-using namespace std;
 using namespace CEC;
 
 #include <libcec/cecloader.h>
 
 
-
-
-#define W_G_HCW(type,code) ( (((ULLONG)(type))<<32) | code)
+#define W_G_HCW(type,code) ((static_cast<ULLONG>(type) << 32) | code)
 
 #define W_HCW_KC 1 /* key code as defined by kernel for keyboard and remotes through /dev/input */
 #define W_HCW_CEC 2 /* HDMI_CEC */
@@ -925,15 +922,15 @@ void RemoteLinux::changePowerState(bool poweron){
 // libcec4 API changed these params to pointers rather than copies, and the returns to void
 // Otherwise, these two blocks of code are the same
 
-void RemoteLinux::cecLogMessage(void *param, const cec_log_message* message)
+void RemoteLinux::cecLogMessage(void* /* param */, const cec_log_message* message)
 {
 	Log::getInstance()->log("Remote", Log::DEBUG, "CECLOG: %lld %d %s", message->time, message->level, message->message);
 }
 
-void RemoteLinux::cecKeyPress(void*param, const cec_keypress* key)
+void RemoteLinux::cecKeyPress(void* /* param */, const cec_keypress* key)
 {
 	//Log::getInstance()->log("Remote", Log::DEBUG, "Incoming cec key %d %d", key->keycode,key->duration);
-	if (key->duration==0) ((RemoteLinux*)Remote::getInstance())->incomingCECkey(key->keycode);
+	if (key->duration==0) static_cast<RemoteLinux*>(Remote::getInstance())->incomingCECkey(key->keycode);
 }
 
 void RemoteLinux::cecCommand(void* /* param */, const cec_command* command)
@@ -942,13 +939,13 @@ void RemoteLinux::cecCommand(void* /* param */, const cec_command* command)
 	switch (command->opcode) {
 	case CEC_OPCODE_STANDBY: {
 		if (command->initiator==CECDEVICE_TV) {
-			((RemoteLinux*)Remote::getInstance())->incomingPowerkey(POWEROFF);
+			static_cast<RemoteLinux*>(Remote::getInstance())->incomingPowerkey(POWEROFF);
 		}
 	} break;
 	case CEC_OPCODE_DECK_CONTROL: {
 		if (command->initiator==CECDEVICE_TV && command->parameters.size == 1
 				&& command->parameters[0]==CEC_DECK_CONTROL_MODE_STOP) {
-			((RemoteLinux*)Remote::getInstance())->incomingCECkey(CEC_USER_CONTROL_CODE_STOP);
+			static_cast<RemoteLinux*>(Remote::getInstance())->incomingCECkey(CEC_USER_CONTROL_CODE_STOP);
 
 		}
 
@@ -956,9 +953,9 @@ void RemoteLinux::cecCommand(void* /* param */, const cec_command* command)
 	case CEC_OPCODE_PLAY: {
 		if (command->initiator==CECDEVICE_TV && command->parameters.size == 1) {
 			if (command->parameters[0]==CEC_PLAY_MODE_PLAY_FORWARD) {
-				((RemoteLinux*)Remote::getInstance())->incomingCECkey(CEC_USER_CONTROL_CODE_PLAY);
+				static_cast<RemoteLinux*>(Remote::getInstance())->incomingCECkey(CEC_USER_CONTROL_CODE_PLAY);
 			} else if (command->parameters[0]==CEC_PLAY_MODE_PLAY_STILL) {
-				((RemoteLinux*)Remote::getInstance())->incomingCECkey(CEC_USER_CONTROL_CODE_PAUSE);
+				static_cast<RemoteLinux*>(Remote::getInstance())->incomingCECkey(CEC_USER_CONTROL_CODE_PAUSE);
 			}
 		}
 
@@ -969,7 +966,7 @@ void RemoteLinux::cecCommand(void* /* param */, const cec_command* command)
 	};
 }
 
-void RemoteLinux::cecConfigurationChanged(void* /* param */, const libcec_configuration* config)
+void RemoteLinux::cecConfigurationChanged(void* /* param */, const libcec_configuration*)
 {
 	Log::getInstance()->log("Remote", Log::DEBUG, "CECConfig:"/*,config->string()*/);
 }
@@ -1035,7 +1032,7 @@ void  RemoteLinux::cecSourceActivated(void* /* param */, const cec_logical_addre
 {
 	Log::getInstance()->log("Remote", Log::DEBUG, "CECSourceActivated: %d %d", address, activated);
 	if (activated==1) {
-		((RemoteLinux*)Remote::getInstance())->incomingPowerkey(POWERON);
+		static_cast<RemoteLinux*>(Remote::getInstance())->incomingPowerkey(POWERON);
 	}
 }
 
@@ -1043,7 +1040,6 @@ void RemoteLinux::incomingCECkey(int keys)
 {
 	curcec=keys;
 	hascurcec=true;
-
 }
 
 void RemoteLinux::incomingPowerkey(UCHAR key){
diff --git a/remotelinux.h b/remotelinux.h
index 84462cf..fe382fe 100644
--- a/remotelinux.h
+++ b/remotelinux.h
@@ -82,7 +82,7 @@ class RemoteLinux : public Remote
 
     UCHAR TranslateHWCFixed(ULLONG code);
     void InitKeymap();
-    vector<int> devices;
+    std::vector<int> devices;
     int num_loop;
 
     CEC::ICECAdapter * cec_adap;
diff --git a/serialize.h b/serialize.h
index d60534a..ffba6b9 100644
--- a/serialize.h
+++ b/serialize.h
@@ -20,10 +20,11 @@
 
 #ifndef SERIALIZE_H
 #define SERIALIZE_H
-#include <vector>
-using namespace std;
+
 #include <stdio.h>
 #include <string.h>
+#include <vector>
+
 #include "defines.h"
 
 class SerializeBuffer {
@@ -59,9 +60,9 @@ class SerializeBuffer {
     int decodeByte(UCHAR &data);
 
   private:
-    UCHAR * start;
-    UCHAR * end;
-    UCHAR * current;
+    UCHAR* start;
+    UCHAR* end;
+    UCHAR* current;
     ULONG size;
     bool useMalloc;
     bool owning;
@@ -210,7 +211,7 @@ class SerializableList : public Serializable{
       TULONG,
       TULLONG,
       TCHAR } Ptypes;
-    struct Pentry{
+    struct Pentry {
       Ptypes ptype;
       bool isDeserialized;
       USHORT version;
@@ -229,7 +230,7 @@ class SerializableList : public Serializable{
       }
       bool isEqual(void *p,Ptypes t);
     } ;
-    vector<struct Pentry>list;
+    std::vector<struct Pentry>list;
     Pentry *findEntry(void *p,Ptypes t);
 };
 
diff --git a/surfacevector.cc b/surfacevector.cc
index d21e03c..52b19ec 100644
--- a/surfacevector.cc
+++ b/surfacevector.cc
@@ -35,7 +35,7 @@ SurfaceVector::SurfaceVector(OsdVector* vosd)
 SurfaceVector::~SurfaceVector()
 {
 	osd->removeSurface(this);
-	vector<SVGCommand>::iterator itty=commands.begin();
+	std::vector<SVGCommand>::iterator itty=commands.begin();
 	while (itty!=commands.end())
 	{
 		osd->removeStyleRef((*itty).getRef()); // We remove the Style reference, so that osd can free stuff
@@ -329,8 +329,8 @@ void SurfaceVector::drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int hei
 int SurfaceVector::removeCommands(float x,float y,float width,float height)
 {
 	// we iterate through all old commands in order to remove commands hidden by this rectangle
-	vector<SVGCommand>::iterator itty=commands.begin();
-	vector<SVGCommand>::iterator remstart;
+	std::vector<SVGCommand>::iterator itty=commands.begin();
+	std::vector<SVGCommand>::iterator remstart;
 	bool remove=false;
 	float cx, cy, cw, ch;
 	cx = cy = 0.f;
@@ -404,7 +404,7 @@ void SurfaceVector::endFastDraw() {
 void SurfaceVector::drawTTChar(int ox, int oy,int x, int y, cTeletextChar c)
 {
 	command_mutex.Lock();
-	vector<SVGCommand>::iterator itty=commands.begin();
+	std::vector<SVGCommand>::iterator itty=commands.begin();
 	while (itty!=commands.end())
 	{
 		if ((*itty).TTTest(ox,oy,x,y) ) {
diff --git a/teletextdecodervbiebu.h b/teletextdecodervbiebu.h
index 54a1d86..8223eea 100644
--- a/teletextdecodervbiebu.h
+++ b/teletextdecodervbiebu.h
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 /* Portions from vdr osdteletext plugin "txtrender.c": */
 /***************************************************************************
@@ -173,21 +172,21 @@ public:
         { return cTeletextChar((c&~CHAR)|chr); }
         
     inline enumCharsets GetCharset() 
-        { return (enumCharsets)(c&CHARSET); }
+        { return static_cast<enumCharsets>(c&CHARSET); }
     inline void SetCharset(enumCharsets charset) 
         { c=(c&~CHARSET)|charset; }
     inline cTeletextChar ToCharset(enumCharsets charset) 
         { return cTeletextChar((c&~CHARSET)|charset); }
     
     inline enumTeletextColor GetFGColor() 
-        { return (enumTeletextColor)((c&FGCOLOR) >> LowestSet32Bit(FGCOLOR)); }
+        { return static_cast<enumTeletextColor>((c&FGCOLOR) >> LowestSet32Bit(FGCOLOR)); }
     inline void SetFGColor(enumTeletextColor fgc) 
         { c=(c&~FGCOLOR) | (fgc << LowestSet32Bit(FGCOLOR)); }
     inline cTeletextChar ToFGColor(enumTeletextColor fgc) 
         { return cTeletextChar((c&~FGCOLOR) | (fgc << LowestSet32Bit(FGCOLOR))); }
     
     inline enumTeletextColor GetBGColor() 
-        { return (enumTeletextColor)((c&BGCOLOR) >> LowestSet32Bit(BGCOLOR)); }
+        { return static_cast<enumTeletextColor>((c&BGCOLOR) >> LowestSet32Bit(BGCOLOR)); }
     inline void SetBGColor(enumTeletextColor bgc) 
         { c=(c&~BGCOLOR) | (bgc << LowestSet32Bit(BGCOLOR)); }
     inline cTeletextChar ToBGColor(enumTeletextColor bgc) 
@@ -208,14 +207,14 @@ public:
         { return cTeletextChar((Dirty)?(c|DIRTY):(c&~DIRTY)); }
     
     inline enumDblHeight GetDblHeight() 
-        { return (enumDblHeight)(c&DBLHEIGHT); }
+        { return static_cast<enumDblHeight>(c&DBLHEIGHT); }
     inline void SetDblHeight(enumDblHeight dh) 
         { c=(c&~(DBLHEIGHT)) | dh; }
     inline cTeletextChar ToDblHeight(enumDblHeight dh) 
         { return cTeletextChar((c&~(DBLHEIGHT)) | dh); }
     
     inline enumDblWidth GetDblWidth() 
-        { return (enumDblWidth)(c&DBLWIDTH); }
+        { return static_cast<enumDblWidth>(c&DBLWIDTH); }
     inline void SetDblWidth(enumDblWidth dw) 
         { c=(c&~(DBLWIDTH)) | dw; }
     inline cTeletextChar ToDblWidth(enumDblWidth dw) 
diff --git a/timers.h b/timers.h
index b879592..36db443 100644
--- a/timers.h
+++ b/timers.h
@@ -132,9 +132,7 @@ class TimerEvent : public Thread_TYPE
 };
 
 
-using namespace std;
-
-typedef list<TimerEvent*> TimerList;
+typedef std::list<TimerEvent*> TimerList;
 
 class Timers : public Thread_TYPE
 {
diff --git a/vaudioselector.cc b/vaudioselector.cc
index eed93ec..6025720 100644
--- a/vaudioselector.cc
+++ b/vaudioselector.cc
@@ -27,7 +27,7 @@
 #include "boxstack.h"
 #include "i18n.h"
 #include "message.h"
-#include "command.h"
+#include "messagequeue.h"
 #include "recinfo.h"
 #include "log.h"
 #include "channel.h"
@@ -441,7 +441,7 @@ VAudioSelector::~VAudioSelector()
   m->from = this;
   m->to = parent;
   m->message = Message::CHILD_CLOSE;
-  Command::getInstance()->postMessageNoLock(m);
+  MessageQueue::getInstance()->postMessageNoLock(m);
 }
 
 void VAudioSelector::draw()
@@ -486,7 +486,7 @@ int VAudioSelector::handleCommand(int command)
             m->to = parent;
             m->message = Message::SUBTITLE_CHANGE_CHANNEL;
             m->parameter.num = (((AudioSubtitleChannel*)ssl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioSubtitleChannel*)ssl.getCurrentOptionData())->type &0xFF)<<16 ;
-            Command::getInstance()->postMessageNoLock(m);
+            MessageQueue::getInstance()->postMessageNoLock(m);
         } else {
             asl.up();
             asl.draw();
@@ -496,7 +496,7 @@ int VAudioSelector::handleCommand(int command)
             m->to = parent;
             m->message = Message::AUDIO_CHANGE_CHANNEL;
             m->parameter.num = (((AudioSubtitleChannel*)asl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioSubtitleChannel*)asl.getCurrentOptionData())->type &0xFF)<<16 ;
-            Command::getInstance()->postMessageNoLock(m);
+            MessageQueue::getInstance()->postMessageNoLock(m);
         }
 
       return 2;
@@ -514,7 +514,7 @@ int VAudioSelector::handleCommand(int command)
             m->message = Message::SUBTITLE_CHANGE_CHANNEL;
             m->parameter.num = (((AudioSubtitleChannel*)ssl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioSubtitleChannel*)ssl.getCurrentOptionData())->type &0xFF)<<16
             		|(((AudioSubtitleChannel*)asl.getCurrentOptionData())->streamtype &0xFF)<<24 ;
-            Command::getInstance()->postMessageNoLock(m);
+            MessageQueue::getInstance()->postMessageNoLock(m);
         } else {
             asl.down();
             asl.draw();
@@ -525,7 +525,7 @@ int VAudioSelector::handleCommand(int command)
             m->message = Message::AUDIO_CHANGE_CHANNEL;
             m->parameter.num = (((AudioSubtitleChannel*)asl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioSubtitleChannel*)asl.getCurrentOptionData())->type &0xFF)<<16
             		|(((AudioSubtitleChannel*)asl.getCurrentOptionData())->streamtype &0xFF)<<24 ;
-            Command::getInstance()->postMessageNoLock(m);
+            MessageQueue::getInstance()->postMessageNoLock(m);
         }
 
       return 2;
@@ -583,7 +583,7 @@ void VAudioSelector::processMessage(Message* m)
               m2->to = parent;
               m2->message = Message::AUDIO_CHANGE_CHANNEL;
               m2->parameter.num = (((AudioSubtitleChannel*)asl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioSubtitleChannel*)asl.getCurrentOptionData())->type &0xFF)<<16 ;
-              Command::getInstance()->postMessageNoLock(m2);
+              MessageQueue::getInstance()->postMessageNoLock(m2);
           }
           return;
         
@@ -605,7 +605,7 @@ void VAudioSelector::processMessage(Message* m)
               m2->to = parent;
               m2->message = Message::SUBTITLE_CHANGE_CHANNEL;
               m2->parameter.num = (((AudioSubtitleChannel*)ssl.getCurrentOptionData())->pestype &0xFFFF)|(((AudioSubtitleChannel*)ssl.getCurrentOptionData())->type &0xFF)<<16 ;
-              Command::getInstance()->postMessageNoLock(m2);
+              MessageQueue::getInstance()->postMessageNoLock(m2);
           }
          return;
      } 
diff --git a/vaudioselector.h b/vaudioselector.h
index 63efe33..17b229e 100644
--- a/vaudioselector.h
+++ b/vaudioselector.h
@@ -49,8 +49,7 @@ class AudioSubtitleChannel
 };
 
 
-
-typedef vector<AudioSubtitleChannel*> AudioSubtitleChannelList;
+typedef std::vector<AudioSubtitleChannel*> AudioSubtitleChannelList;
 
 class VAudioSelector : public TBBoxx
 {
diff --git a/vdp6.h b/vdp6.h
index 4796560..c3becdf 100644
--- a/vdp6.h
+++ b/vdp6.h
@@ -41,13 +41,13 @@ class VDP6
     void run();
     void stop();
     int numFound();
-    vector<VDRServer>* getServers() { return &servers; }
+    std::vector<VDRServer>* getServers() { return &servers; }
 
   private:
     int pfds[2];
     int sock;
     std::thread receiveThread;
-    vector<VDRServer> servers;
+    std::vector<VDRServer> servers;
 };
 
 #endif
diff --git a/vdr.cc b/vdr.cc
index 8049ea3..dbe6e02 100644
--- a/vdr.cc
+++ b/vdr.cc
@@ -161,7 +161,7 @@ int VDR::shutdown()
   return 1;
 }
 
-void VDR::findServers(vector<VDRServer>& servers)
+void VDR::findServers(std::vector<VDRServer>& servers)
 {
   Wol* wol = Wol::getInstance();
   findingServer = 1;
@@ -252,7 +252,7 @@ void VDR::findServers(vector<VDRServer>& servers)
 
 #if IPV6
   vdp6.stop();
-  vector<VDRServer>* servers6 = vdp6.getServers();
+  std::vector<VDRServer>* servers6 = vdp6.getServers();
   
   // Add IPv6 found servers to servers vector, if not in servers already
   // Free buffers from VDRServer objects if not taken. (Itching for that rewrite already).
@@ -1635,8 +1635,8 @@ I18n::lang_code_list VDR::getLanguageList()
   {
     char* c_code = vresp->extractString();
     char* c_name = vresp->extractString();
-    string code = c_code;
-    string name = c_name;
+    std::string code = c_code;
+    std::string name = c_name;
     CodeList[code] = name;
     delete[] c_code;
     delete[] c_name;
@@ -1657,8 +1657,8 @@ int VDR::getLanguageContent(const std::string code, I18n::trans_table& texts)
   {
     char* c_key = vresp->extractString();
     char* c_text = vresp->extractString();
-    string key = c_key;
-    string text = c_text;
+    std::string key = c_key;
+    std::string text = c_text;
     texts[key] = text;
     delete[] c_key;
     delete[] c_text;
diff --git a/vdr.h b/vdr.h
index 7e8d7ec..928b24f 100644
--- a/vdr.h
+++ b/vdr.h
@@ -58,12 +58,9 @@ class MovieInfo;
 class SeriesInfo;
 class TVMediaInfo;
 
-
-using namespace std;
-
-typedef vector<Event*> EventList;
-typedef vector<Channel*> ChannelList;
-typedef vector<RecTimer*> RecTimerList;
+typedef std::vector<Event*> EventList;
+typedef std::vector<Channel*> ChannelList;
+typedef std::vector<RecTimer*> RecTimerList;
 
 struct VDRServer
 {
@@ -142,7 +139,7 @@ public ExternLogger
     int init();
     int shutdown();
 
-    void findServers(vector<VDRServer>& servers);
+    void findServers(std::vector<VDRServer>& servers);
     void cancelFindingServer();
     void setServerIP(char*);
     void setServerPort(USHORT);
@@ -229,7 +226,7 @@ public ExternLogger
 
 
     I18n::lang_code_list getLanguageList();
-    int           getLanguageContent(const string code, I18n::trans_table&);
+    int           getLanguageContent(const std::string code, I18n::trans_table&);
 
     // end protocol functions
 
diff --git a/vepg.cc b/vepg.cc
index bc2285c..aa0099f 100644
--- a/vepg.cc
+++ b/vepg.cc
@@ -35,7 +35,7 @@
 
 #include "remote.h"
 #include "vchannellist.h"
-#include "command.h"
+#include "messagequeue.h"
 #include "video.h"
 #include "vepgsettimer.h"
 #include "timers.h"
@@ -453,7 +453,7 @@ int VEpg::handleCommand(int command)
         m->to = parent;
         m->message = Message::CHANNEL_CHANGE;
         m->parameter.num = (*chanList)[currentChannelIndex]->number;
-        Command::getInstance()->postMessageNoLock(m);
+        MessageQueue::getInstance()->postMessageNoLock(m);
       }
       
       setCurrentChannel();
@@ -481,7 +481,7 @@ int VEpg::handleCommand(int command)
         m->to = parent;
         m->message = Message::CHANNEL_CHANGE;
         m->parameter.num = (*chanList)[currentChannelIndex]->number;
-        Command::getInstance()->postMessageNoLock(m);
+        MessageQueue::getInstance()->postMessageNoLock(m);
       }
       
       setCurrentChannel();
@@ -502,7 +502,7 @@ int VEpg::handleCommand(int command)
         m->to = parent;
         m->message = Message::CHANNEL_CHANGE;
         m->parameter.num = (*chanList)[currentChannelIndex]->number;
-        Command::getInstance()->postMessageNoLock(m);
+        MessageQueue::getInstance()->postMessageNoLock(m);
       }
       
       setCurrentChannel();
diff --git a/videoomx.cc b/videoomx.cc
index f9d5c30..76b6292 100644
--- a/videoomx.cc
+++ b/videoomx.cc
@@ -359,7 +359,7 @@ void VideoOMX::executePendingModeChanges()
 		Osd::getInstance()->shutdown();
 		selectVideoMode(0);
 		Osd::getInstance()->restore();
-		Osd::getInstance()->init((void*) "");
+		Osd::getInstance()->init();
 		BoxStack::getInstance()->redrawAllBoxes();
 		initted = 1;
 	}
@@ -738,7 +738,7 @@ int VideoOMX::signalOn()
 	  Log::getInstance()->log("Video", Log::NOTICE, "signalOn");
 	  selectVideoMode(0);
 	  Osd::getInstance()->restore();
-	  Osd::getInstance()->init((void*)"");
+	  Osd::getInstance()->init();
 	  BoxStack::getInstance()->redrawAllBoxes();
 	  initted=1;
 
@@ -790,7 +790,7 @@ void VideoOMX::interlaceSwitch4Demux() {
 			selectVideoMode(set_interlaced);
 			Osd::getInstance()->shutdown();
 			Osd::getInstance()->restore();
-			Osd::getInstance()->init((void*)"");
+			Osd::getInstance()->init();
 			BoxStack::getInstance()->redrawAllBoxes();
 			initted=1;
 		}
@@ -1768,7 +1768,7 @@ int VideoOMX::WaitForEvent(OMX_HANDLETYPE handle,OMX_U32 event, int wait) //need
 	int iend=(wait/5+1);
 	while (i<iend) {
 		omx_event_mutex.Lock();
-		list<VPE_OMX_EVENT>::iterator itty=omx_events.begin();
+		std::list<VPE_OMX_EVENT>::iterator itty=omx_events.begin();
 		while (itty!=omx_events.end()) {
 
 			VPE_OMX_EVENT current=*itty;
@@ -1812,7 +1812,7 @@ int VideoOMX::clearEvents()
 int VideoOMX::clearEventsForComponent(OMX_HANDLETYPE handle)
 {
 	omx_event_mutex.Lock();
-	list<VPE_OMX_EVENT>::iterator itty=omx_events.begin();
+	std::list<VPE_OMX_EVENT>::iterator itty=omx_events.begin();
 	while (itty!=omx_events.end()) {
 		VPE_OMX_EVENT current=*itty;
 		if (current.handle==handle) { //this is ours
@@ -1831,7 +1831,7 @@ void VideoOMX::checkForStalledBuffers()
 	//Log::getInstance()->log("Video", Log::DEBUG, "Check stalled");
 	clock_mutex.Lock();
 	omx_event_mutex.Lock();
-	list<VPE_OMX_EVENT>::iterator itty=omx_events.begin();
+	std::list<VPE_OMX_EVENT>::iterator itty=omx_events.begin();
 	while (itty!=omx_events.end()) {
 		VPE_OMX_EVENT current=*itty;
 		if (current.event_type==OMX_EventParamOrConfigChanged && current.data1==omx_codec_output_port
@@ -1875,7 +1875,7 @@ int VideoOMX::CommandFinished(OMX_HANDLETYPE handle,OMX_U32 command,OMX_U32 data
 	int i=0;
 	while (i<200/*1000*/) {
 		omx_event_mutex.Lock();
-		list<VPE_OMX_EVENT>::iterator itty=omx_events.begin();
+		std::list<VPE_OMX_EVENT>::iterator itty=omx_events.begin();
 		while (itty!=omx_events.end()) {
 
 			VPE_OMX_EVENT current=*itty;
@@ -2867,8 +2867,8 @@ void VideoOMX::PrepareMediaSample(const MediaPacketList& mplist,UINT samplepos)
 {
 
 	mediapackets.clear();
-	list<MediaPacket>::const_iterator begin=mplist.begin();
-	list<MediaPacket>::const_iterator itty=mplist.begin();
+	std::list<MediaPacket>::const_iterator begin=mplist.begin();
+	std::list<MediaPacket>::const_iterator itty=mplist.begin();
 	advance(itty,min(mplist.size(),10));
 	mediapackets.insert(mediapackets.begin(),begin,itty);//front
 
diff --git a/videoomx.h b/videoomx.h
index 121ce2f..7b8ad14 100644
--- a/videoomx.h
+++ b/videoomx.h
@@ -87,7 +87,7 @@ class VideoOMX : public Video
     int setMode(UCHAR mode);
     bool setVideoDisplay(VideoDisplay display);
     int setTVsize(UCHAR size);               // Is the TV a widescreen?
-   UCHAR getTVsize();
+    UCHAR getTVsize();
 
     void executePendingModeChanges();
     int setDefaultAspect();
@@ -269,8 +269,8 @@ class VideoOMX : public Video
 	   int DeAllocateCodecsOMX();
 	   int FlushRenderingPipe();
 
-	   vector<OMX_BUFFERHEADERTYPE*> input_bufs_omx_all;
-	   list<OMX_BUFFERHEADERTYPE*> input_bufs_omx_free;
+	   std::vector<OMX_BUFFERHEADERTYPE*> input_bufs_omx_all;
+	   std::list<OMX_BUFFERHEADERTYPE*> input_bufs_omx_free;
 	   Mutex input_bufs_omx_mutex;
 	   OMX_BUFFERHEADERTYPE* cur_input_buf_omx;
 
@@ -284,7 +284,7 @@ class VideoOMX : public Video
 	   Mutex omx_event_mutex;
 	   Signal omx_event_ready_signal;
 
-	   list<VPE_OMX_EVENT> omx_events;
+	   std::list<VPE_OMX_EVENT> omx_events;
 
 	   bool omx_mpeg2;
 	   bool omx_h264;
@@ -309,7 +309,7 @@ class VideoOMX : public Video
 	   bool firstsynched;
 
 
-	   vector<MediaPacket> mediapackets;
+	   std::vector<MediaPacket> mediapackets;
 
 	   char L_VPE_OMX_CLOCK[128];
 	   char L_VPE_OMX_H264_DECODER[128];
diff --git a/videowin.h b/videowin.h
index c379049..43ea009 100644
--- a/videowin.h
+++ b/videowin.h
@@ -42,8 +42,7 @@ struct VideoFilterDesc {
     bool vmr9;
     bool vmr9tested;
 };
-using namespace std;
-typedef vector<VideoFilterDesc> VideoFilterDescList;
+typedef std::vector<VideoFilterDesc> VideoFilterDescList;
 #endif
 
 class DsSourceFilter;
diff --git a/vmedialist.cc b/vmedialist.cc
index a104e3a..7bbb7c9 100644
--- a/vmedialist.cc
+++ b/vmedialist.cc
@@ -74,7 +74,6 @@
 #include "localmediafile.h"
 #include "mediaoptions.h"
 
-using namespace std;
 //a ref count holder
 class MediaListHolder {
   public:
@@ -185,7 +184,7 @@ class MediaDirectory {
 		}
 };
 
-typedef vector<MediaDirectory*> MDirList;
+typedef std::vector<MediaDirectory*> MDirList;
 class DirList {
 	private:
 		int current;
@@ -362,7 +361,7 @@ VMediaList::~VMediaList()
   Timers::getInstance()->cancelTimer(this,1);
   Timers::getInstance()->cancelTimer(this,2);
   removeViewer();
-	delete dirlist;
+  delete dirlist;
   if (audiodirlist) delete audiodirlist;
   Log::getInstance()->log("VMediaList::~VMediaList", Log::DEBUG, "finished");
 }
@@ -717,15 +716,15 @@ int VMediaList::handleCommand(int command)
   playingAll=false;
   switch(command)
   {
-		case Remote::ONE:
-			{
+    case Remote::ONE:
+    {
       sl.hintSetCurrent(0);
       sl.draw();
       updateSelection();
       doShowingBar();
       boxstack->update(this);
       return 2;
-			}
+    }
     case Remote::DF_UP:
     case Remote::UP:
     {
diff --git a/vopts.cc b/vopts.cc
index fa196f8..505763a 100644
--- a/vopts.cc
+++ b/vopts.cc
@@ -38,7 +38,8 @@
 #include "mediaoptions.h"
 #endif
 //#include "vdr.h"
-//#include "command.h"
+#include "command.h"
+#include "messagequeue.h"
 
 VOpts::VOpts()
 {
@@ -100,7 +101,7 @@ VOpts::VOpts()
 
   UINT suppconn = Video::getInstance()->getSupportedFormats();
   if (suppconn) {
-	  int defaultch = 0;
+	  UINT defaultch = 0;
 	  if (suppconn & Video::COMPOSITERGB) {
 		  defaultch = 0;
 		  options3.push_back("RGB+composite");
@@ -129,7 +130,7 @@ VOpts::VOpts()
 
   UINT suppformats = Video::getInstance()->supportedTVFormats();
   if (suppformats) {
-	  int defaultch = 0;
+	  UINT defaultch = 0;
 	  options16.push_back("NTSC");
 	  options16keys.push_back("NTSC");
 	  if (suppformats & Video::PAL) {
@@ -156,7 +157,7 @@ VOpts::VOpts()
 
   UINT supptvsize=Video::getInstance()->supportedTVsize();
   if (supptvsize) {
-	  int defaultch=0;
+	  UINT defaultch=0;
 	  options4.push_back("4:3");
 	  options4keys.push_back("4:3");
       if (Video::ASPECT16X9 & supptvsize) {
@@ -273,7 +274,7 @@ VOpts::~VOpts()
  // for (int i = 0; i < numPanes; i++) delete panes[i]; //Move to TabBar, Marten
   delete[] panes;
 
-  for(vector<Option*>::iterator j = options.begin(); j != options.end(); j++) delete *j;
+  for(std::vector<Option*>::iterator j = options.begin(); j != options.end(); j++) delete *j;
   delete[] options2;
   delete[] options2keys;
 }
@@ -320,12 +321,12 @@ void VOpts::doSave()
   // Damn, and the dynamic idea was going *so* well...
   //Whats about a check with typeid operator?
   WOptionPane* wop;
-  wop = (WOptionPane*)panes[0];
-  wop->saveOpts();  
-  wop = (WOptionPane*)panes[1];
-  wop->saveOpts();  
-  wop = (WOptionPane*)panes[2];
+  wop = static_cast<WOptionPane*>(panes[0]);
   wop->saveOpts();  
+  wop = static_cast<WOptionPane*>(panes[1]);
+  wop->saveOpts();
+  wop = static_cast<WOptionPane*>(panes[2]);
+  wop->saveOpts();
 
 
   for (UINT i = 0; i < options.size(); i++)
@@ -365,7 +366,7 @@ void VOpts::doSave()
           Message* m = new Message();
           m->message = Message::CHANGE_LANGUAGE;
           m->to = Command::getInstance();
-          Command::getInstance()->postMessageNoLock(m);
+          MessageQueue::getInstance()->postMessageNoLock(m);
           break;
         }
         case 3:
@@ -464,12 +465,12 @@ void VOpts::doSave()
         	if (options[i]->userSetChoice == 1)
         	{
         		Log::getInstance()->log("Options", Log::DEBUG, "Setting classic menu");
-        		Command::getInstance()->setAdvMenues(false);
+        		Command::getInstance()->setAdvMenus(false);
         	}
         	else
         	{
         		Log::getInstance()->log("Options", Log::DEBUG, "Setting advanced menu");
-        		Command::getInstance()->setAdvMenues(true);
+        		Command::getInstance()->setAdvMenus(true);
         	}
         	break;
         }
diff --git a/vopts.h b/vopts.h
index 416aeb7..e2e2da3 100644
--- a/vopts.h
+++ b/vopts.h
@@ -58,11 +58,11 @@ class VOpts : public TBBoxx
     // be valid for the lifetime of the VOpts instance, because we
     // create Option objects with pointers into LangCode's data.
 
-    vector<const char*> options4; // this is for tv size
-    vector<const char*> options4keys;
-    vector<const char*> options3; // this is for tv size
-    vector<const char*> options3keys;
-    vector<const char*> options16; // this is for tv standard
-    vector<const char*> options16keys;
+    std::vector<const char*> options4; // this is for tv size
+    std::vector<const char*> options4keys;
+    std::vector<const char*> options3; // this is for tv size
+    std::vector<const char*> options3keys;
+    std::vector<const char*> options16; // this is for tv standard
+    std::vector<const char*> options16keys;
 };
 #endif
diff --git a/vquestion.cc b/vquestion.cc
index 307df44..356b012 100644
--- a/vquestion.cc
+++ b/vquestion.cc
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #include "vquestion.h"
@@ -24,7 +23,7 @@
 #include "boxstack.h"
 #include "colour.h"
 #include "i18n.h"
-#include "command.h"
+#include "messagequeue.h"
 
 VQuestion::VQuestion(void* treplyTo)
 {
@@ -110,7 +109,7 @@ int VQuestion::handleCommand(int command)
       m->from = this;
       m->to = replyTo;
       m->message = Message::QUESTION_YES;
-      Command::getInstance()->postMessageNoLock(m);
+      MessageQueue::getInstance()->postMessageNoLock(m);
 
       return 4;
     }
diff --git a/vquestion.h b/vquestion.h
index 7fbf061..d061a55 100644
--- a/vquestion.h
+++ b/vquestion.h
@@ -14,8 +14,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
 #ifndef VQUESTION_H
diff --git a/vrecordinglist.h b/vrecordinglist.h
index 8db32bc..0a59671 100644
--- a/vrecordinglist.h
+++ b/vrecordinglist.h
@@ -65,7 +65,7 @@ class VRecordingList : public TBBoxx
 
     virtual void quickUpdate()=0;
 
-    stack<int> slIndexStack;
+    std::stack<int> slIndexStack;
 };
 
 #endif
diff --git a/vserverselect.cc b/vserverselect.cc
index d6219d2..e9f9839 100644
--- a/vserverselect.cc
+++ b/vserverselect.cc
@@ -29,7 +29,7 @@
 #include "command.h"
 
 
-VServerSelect::VServerSelect(vector<VDRServer>& servers, void* treplyTo)
+VServerSelect::VServerSelect(std::vector<VDRServer>& servers, void* treplyTo)
 {
   // I tried the whole passing using a reference here, but
   // the program segfaulted when settitletext tried to new
diff --git a/vserverselect.h b/vserverselect.h
index ffe62d0..2a4a022 100644
--- a/vserverselect.h
+++ b/vserverselect.h
@@ -31,12 +31,10 @@
 
 class Message;
 
-using namespace std;
-
 class VServerSelect : public TBBoxx
 {
   public:
-    VServerSelect(vector<VDRServer>& servers, void* replyTo);
+    VServerSelect(std::vector<VDRServer>& servers, void* replyTo);
     ~VServerSelect();
 
     int handleCommand(int command);
diff --git a/vsleeptimer.cc b/vsleeptimer.cc
index 4b3df05..278c598 100644
--- a/vsleeptimer.cc
+++ b/vsleeptimer.cc
@@ -27,6 +27,7 @@
 #include "timers.h"
 #include "boxstack.h"
 #include "command.h"
+#include "messagequeue.h"
 
 Sleeptimer* Sleeptimer::instance = NULL;
 
@@ -162,13 +163,13 @@ void Sleeptimer::threadMethod()
 	     VCountdown* count = new VCountdown();
              char* temp = (char*)malloc(20);
 	     sprintf(temp, "0:%02d", sec);
-	     count->draw(temp);
+	     count->drawClock(temp);
 	     free(temp);
 	     Message* m1 = new Message();
 	     m1->message = Message::ADD_VIEW;
          m1->to = BoxStack::getInstance();
 	     m1->parameter.num = (ULONG)count;
-	     Command::getInstance()->postMessageNoLock(m1);
+	     MessageQueue::getInstance()->postMessageNoLock(m1);
 	  }
 	 MILLISLEEP(1000);
 	
@@ -180,7 +181,7 @@ void Sleeptimer::threadMethod()
 	     m2->to = Command::getInstance();
 	     m2->from = this;
 		 m2->parameter.num = 61;
-	     Command::getInstance()->postMessageFromOuterSpace(m2);
+	     MessageQueue::getInstance()->postMessageFromOuterSpace(m2);
 	     shutdown();
 	  }
 	
@@ -242,7 +243,7 @@ void VSleeptimer::timercall(int clientReference)
   m->message = Message::CLOSE_ME;
   m->to = BoxStack::getInstance();
   m->from = this;
-  Command::getInstance()->postMessageFromOuterSpace(m);
+  MessageQueue::getInstance()->postMessageFromOuterSpace(m);
 }
 
 int VSleeptimer::handleCommand(int command)
@@ -287,7 +288,7 @@ VCountdown::~VCountdown()
   Timers::getInstance()->cancelTimer(this, 1);
 }
 
-void VCountdown::draw(const char* sec)
+void VCountdown::drawClock(const char* sec)
 {
    
    fillColour(DrawStyle::VIEWBACKGROUND);
@@ -310,5 +311,5 @@ void VCountdown::timercall(int clientReference)
   m->message = Message::CLOSE_ME;
   m->to = BoxStack::getInstance();
   m->from = this;
-  Command::getInstance()->postMessageFromOuterSpace(m);
+  MessageQueue::getInstance()->postMessageFromOuterSpace(m);
 }
diff --git a/vsleeptimer.h b/vsleeptimer.h
index d5bb518..d8f7808 100644
--- a/vsleeptimer.h
+++ b/vsleeptimer.h
@@ -71,7 +71,7 @@ class VCountdown : public Boxx, public TimerReceiver
  public:
        VCountdown();
        ~VCountdown();
-       void draw(const char* sec);
+       void drawClock(const char* sec);
        void timercall(int clientReference);
    
 }
diff --git a/vvideolivetv.cc b/vvideolivetv.cc
index 62d2189..94a9e56 100644
--- a/vvideolivetv.cc
+++ b/vvideolivetv.cc
@@ -713,7 +713,7 @@ void VVideoLiveTV::doEPG()
 {
   if (osd.getVisible()) clearScreen();
 
-  if (!Command::getInstance()->advMenues())
+  if (!Command::getInstance()->isAdvMenus())
   {
     VEpg* vepg = new VEpg(this, currentChannelIndex, chanList);
     vepg->draw();
diff --git a/vvolume.cc b/vvolume.cc
index 02cbf74..0cbb104 100644
--- a/vvolume.cc
+++ b/vvolume.cc
@@ -27,7 +27,7 @@
 #include "video.h"
 #include "timers.h"
 #include "boxstack.h"
-#include "command.h"
+#include "messagequeue.h"
 
 VVolume::VVolume()
 {
@@ -89,7 +89,7 @@ void VVolume::timercall(int clientReference)
   m->message = Message::CLOSE_ME;
   m->to = BoxStack::getInstance();
   m->from = this;
-  Command::getInstance()->postMessageFromOuterSpace(m);
+  MessageQueue::getInstance()->postMessageFromOuterSpace(m);
 }
 
 int VVolume::handleCommand(int command)
diff --git a/vwelcome.cc b/vwelcome.cc
index 6a88f3b..adec7d7 100644
--- a/vwelcome.cc
+++ b/vwelcome.cc
@@ -344,11 +344,11 @@ void VWelcome::doRadioList()
 void VWelcome::doRecordingsList()
 {
 	VRecordingList* vrec;
-	if (Command::getInstance()->advMenues()) {
-	   vrec =  new VRecordingListAdvanced();
-	} else {
+	if (Command::getInstance()->isAdvMenus())
+	   vrec = new VRecordingListAdvanced();
+	else
 	   vrec = new VRecordingListClassic();
-	}
+
 	vrec->draw();
 	boxstack->add(vrec);
 	boxstack->update(vrec);
diff --git a/winmain.cc b/winmain.cc
index 0097303..e06cb43 100644
--- a/winmain.cc
+++ b/winmain.cc
@@ -248,7 +248,7 @@ INT WINAPI WinMain( HINSTANCE hinst , HINSTANCE previnst, LPSTR cmdline, int cmd
   }
 
   dynamic_cast<WindowsOsd*>(osd)->setWindow(win);
-  success = osd->init(NULL);
+  success = osd->init();
   if (success)
   {
     logger->log("Core", Log::INFO, "OSD module initialised");
diff --git a/woptionpane.h b/woptionpane.h
index ca54f0c..5837488 100644
--- a/woptionpane.h
+++ b/woptionpane.h
@@ -46,10 +46,10 @@ class WOptionPane : public Boxx
     int numOptions;
     int selectedOption;
     
-    vector<Option*> options;
+    std::vector<Option*> options;
     
-    vector<WTextbox*> textBoxes;
-    vector<WOptionBox*> optionBoxes;
+    std::vector<WTextbox*> textBoxes;
+    std::vector<WOptionBox*> optionBoxes;
 };
 
 #endif
diff --git a/wpictureview.cc b/wpictureview.cc
index fd1a6bf..50be37c 100644
--- a/wpictureview.cc
+++ b/wpictureview.cc
@@ -57,11 +57,11 @@ void WPictureView::draw()
 
   drawClippingRectangle(1,1,area.w-1,area.h-1);
 
-  list<Picture>::iterator itty=pictures.begin();
+  std::list<Picture>::iterator itty=pictures.begin();
   while (itty!=pictures.end())
   {
 	  // We now calculate the pictures in one row
-	  list<Picture*> cur_pict;
+	  std::list<Picture*> cur_pict;
 	  float cur_width=0;
 	  float max_height=const_height;
 
@@ -75,7 +75,7 @@ void WPictureView::draw()
 		  itty++;
 	  }
 	  // ok now we have a list of pictures, let's draw them
-	  list<Picture*>::iterator citty=cur_pict.begin();
+	  std::list<Picture*>::iterator citty=cur_pict.begin();
 	  float xpos= (area.w - cur_width)*0.5f;
 	  if (xpos < 0) xpos=0;
 	  while (citty!=cur_pict.end())
diff --git a/wpictureview.h b/wpictureview.h
index 04a32c7..84e5032 100644
--- a/wpictureview.h
+++ b/wpictureview.h
@@ -59,7 +59,7 @@ class WPictureView : public Boxx
     	float h;
     	bool banner;
     };
-    list<Picture> pictures;
+    std::list<Picture> pictures;
 
     DrawStyle foreColour;
     unsigned int cur_scroll_line;
diff --git a/wselectlist.h b/wselectlist.h
index 9106484..24b301c 100644
--- a/wselectlist.h
+++ b/wselectlist.h
@@ -29,8 +29,6 @@
 #include "defines.h"
 #include "boxx.h"
 
-using namespace std;
-
 typedef struct
 {
   char* text;
@@ -78,7 +76,7 @@ class WSelectList : public Boxx
     void drawOptionLine(char* text, int xpos, int ypos, int width, const DrawStyle& colour, TVMediaInfo* pict);
     int getMouseLine(int x, int y);
 
-    vector<wsloption> options;
+    std::vector<wsloption> options;
     UINT selectedOption;
     int topOption;
     UINT numOptionsDisplayable;
diff --git a/wtabbar.h b/wtabbar.h
index b3846a4..baa0706 100644
--- a/wtabbar.h
+++ b/wtabbar.h
@@ -54,7 +54,7 @@ class WTabBar : public Boxx
   
     UINT visiblePane;
     bool buttonBarActive;
-    vector<TabDetails> tabs;
+    std::vector<TabDetails> tabs;
     
     WSymbol symbolLeft;
     WSymbol symbolRight;
-- 
2.39.5