diff --git a/gui/qt/bgslibrary_gui.pro b/gui/qt/bgslibrary_gui.pro
index 615e30dcf23acded22c6842363c40bd1ebb7d35c..fd8d7b84a952a9043817b9910fa2be453ae51e6c 100644
--- a/gui/qt/bgslibrary_gui.pro
+++ b/gui/qt/bgslibrary_gui.pro
@@ -25,11 +25,13 @@ message(Settings: $$[QT_INSTALL_SETTINGS])
 message(Examples: $$[QT_INSTALL_EXAMPLES])
 message(Demonstrations: $$[QT_INSTALL_DEMOS])
 
+# https://doc.qt.io/qt-5/qmake-variable-reference.html#config
 CONFIG += c++14
 #CONFIG += no_keywords # Python redefines some qt keywords
 #CONFIG += console
 CONFIG -= app_bundle
 CONFIG += sdk_no_version_check # supress OS warning for 10.14
+#CONFIG += staticlib
 
 # For Windows x64 + Visual Studio 2015 + OpenCV 4.1.1
 win32 {
@@ -44,15 +46,20 @@ win32 {
 }
 
 # For Linux or MacOS
-!win32 {
+unix {
   macx {
     message("Building for MacOS")
     QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14
   } else {
-    message("Building for Unix/Linux")
+    message("Building for Linux")
+    #CONFIG += link_pkgconfig
+    #PKGCONFIG += opencv
   }
+  #pkg-config --cflags --libs opencv
   INCLUDEPATH += /usr/local/include
-  INCLUDEPATH += /usr/local/include/opencv4
+  #INCLUDEPATH += /usr/local/include/opencv
+  INCLUDEPATH += /usr/local/include/opencv2
+  #INCLUDEPATH += /usr/local/include/opencv4
   LIBS += -L/usr/local/lib
   #LIBS += -L/usr/local/Cellar/ffmpeg/3.3.3/lib
   LIBS += -lopencv_core
@@ -62,20 +69,6 @@ win32 {
   LIBS += -lopencv_videoio
   LIBS += -lopencv_highgui
   LIBS += -lopencv_features2d
-  #LIBS += -lopencv_ml
-  #LIBS += -lopencv_calib3d
-  #LIBS += -lopencv_objdetect
-  #LIBS += -lopencv_flann
-  #LIBS += -lopencv_contrib
-  #LIBS += -lopencv_legacy
-  #LIBS += -lavcodec
-  #LIBS += -lavformat
-  #LIBS += -lavutil
-  #LIBS += -lavdevice
-  #LIBS += -lavfilter
-  #LIBS += -lpostproc
-  #LIBS += -lswscale
-  #LIBS += -lswresample
 }
 
 RESOURCES = application.qrc
@@ -83,216 +76,17 @@ RESOURCES = application.qrc
 SOURCES += bgslibrary_gui.cpp\
     mainwindow.cpp \
     qt_utils.cpp \
-    texteditor.cpp \
-    ../../src/tools/ForegroundMaskAnalysis.cpp \
-    ../../src/tools/PerformanceUtils.cpp \
-    ../../src/tools/PixelUtils.cpp \
-    ../../src/algorithms/dp/AdaptiveMedianBGS.cpp \
-    ../../src/algorithms/dp/Eigenbackground.cpp \
-    ../../src/algorithms/dp/Error.cpp \
-    ../../src/algorithms/dp/GrimsonGMM.cpp \
-    ../../src/algorithms/dp/Image.cpp \
-    ../../src/algorithms/dp/MeanBGS.cpp \
-    ../../src/algorithms/dp/PratiMediodBGS.cpp \
-    ../../src/algorithms/dp/TextureBGS.cpp \
-    ../../src/algorithms/dp/WrenGA.cpp \
-    ../../src/algorithms/dp/ZivkovicAGMM.cpp \
-    ../../src/algorithms/IMBS/IMBS.cpp \
-    ../../src/algorithms/KDE/KernelTable.cpp \
-    ../../src/algorithms/KDE/NPBGmodel.cpp \
-    ../../src/algorithms/KDE/NPBGSubtractor.cpp \
-    ../../src/algorithms/lb/BGModel.cpp \
-    ../../src/algorithms/lb/BGModelFuzzyGauss.cpp \
-    ../../src/algorithms/lb/BGModelFuzzySom.cpp \
-    ../../src/algorithms/lb/BGModelGauss.cpp \
-    ../../src/algorithms/lb/BGModelMog.cpp \
-    ../../src/algorithms/lb/BGModelSom.cpp \
-    ../../src/algorithms/LBP_MRF/graph.cpp \
-    ../../src/algorithms/LBP_MRF/maxflow.cpp \
-    ../../src/algorithms/LBP_MRF/MEDefs.cpp \
-    ../../src/algorithms/LBP_MRF/MEHistogram.cpp \
-    ../../src/algorithms/LBP_MRF/MEImage.cpp \
-    ../../src/algorithms/LBP_MRF/MotionDetection.cpp \
-    ../../src/algorithms/LBSP/BackgroundSubtractorLBSP.cpp \
-    ../../src/algorithms/LBSP/BackgroundSubtractorLBSP_.cpp \
-    ../../src/algorithms/LBSP/BackgroundSubtractorLOBSTER.cpp \
-    ../../src/algorithms/LBSP/BackgroundSubtractorPAWCS.cpp \
-    ../../src/algorithms/LBSP/BackgroundSubtractorSuBSENSE.cpp \
-    ../../src/algorithms/LBSP/LBSP.cpp \
-    ../../src/algorithms/LBSP/LBSP_.cpp \
-    ../../src/algorithms/MultiLayer/blob.cpp \
-    ../../src/algorithms/MultiLayer/BlobExtraction.cpp \
-    ../../src/algorithms/MultiLayer/BlobResult.cpp \
-    ../../src/algorithms/MultiLayer/CMultiLayerBGS.cpp \
-    ../../src/algorithms/MultiLayer/LocalBinaryPattern.cpp \
-    ../../src/algorithms/PBAS/PBAS.cpp \
-    ../../src/algorithms/SigmaDelta/sdLaMa091.cpp \
-    ../../src/tools/FuzzyUtils.cpp \
-    ../../src/algorithms/T2F/MRF.cpp \
-    ../../src/algorithms/T2F/T2FGMM.cpp \
-    ../../src/algorithms/T2F/T2FMRF.cpp \
-    ../../src/algorithms/TwoPoints/two_points.cpp \
-    ../../src/algorithms/ViBe/vibe-background-sequential.cpp \
-    ../../src/algorithms/VuMeter/TBackground.cpp \
-    ../../src/algorithms/VuMeter/TBackgroundVuMeter.cpp \
-    ../../src/algorithms/AdaptiveBackgroundLearning.cpp \
-    ../../src/algorithms/AdaptiveSelectiveBackgroundLearning.cpp \
-    ../../src/algorithms/DPAdaptiveMedian.cpp \
-    ../../src/algorithms/DPEigenbackground.cpp \
-    ../../src/algorithms/DPGrimsonGMM.cpp \
-    ../../src/algorithms/DPMean.cpp \
-    ../../src/algorithms/DPPratiMediod.cpp \
-    ../../src/algorithms/DPTexture.cpp \
-    ../../src/algorithms/DPWrenGA.cpp \
-    ../../src/algorithms/DPZivkovicAGMM.cpp \
-    ../../src/algorithms/FrameDifference.cpp \
-    ../../src/algorithms/FuzzyChoquetIntegral.cpp \
-    ../../src/algorithms/FuzzySugenoIntegral.cpp \
-    ../../src/algorithms/GMG.cpp \
-    ../../src/algorithms/IndependentMultimodal.cpp \
-    ../../src/algorithms/KDE.cpp \
-    ../../src/algorithms/KNN.cpp \
-    ../../src/algorithms/LBAdaptiveSOM.cpp \
-    ../../src/algorithms/LBFuzzyAdaptiveSOM.cpp \
-    ../../src/algorithms/LBFuzzyGaussian.cpp \
-    ../../src/algorithms/LBMixtureOfGaussians.cpp \
-    ../../src/algorithms/LBP_MRF.cpp \
-    ../../src/algorithms/LBSimpleGaussian.cpp \
-    ../../src/algorithms/LOBSTER.cpp \
-    ../../src/algorithms/MixtureOfGaussianV1.cpp \
-    ../../src/algorithms/MixtureOfGaussianV2.cpp \
-    ../../src/algorithms/MultiCue.cpp \
-    ../../src/algorithms/MultiLayer.cpp \
-    ../../src/algorithms/PAWCS.cpp \
-    ../../src/algorithms/PixelBasedAdaptiveSegmenter.cpp \
-    ../../src/algorithms/SigmaDelta.cpp \
-    ../../src/algorithms/StaticFrameDifference.cpp \
-    ../../src/algorithms/SuBSENSE.cpp \
-    ../../src/algorithms/T2FGMM_UM.cpp \
-    ../../src/algorithms/T2FGMM_UV.cpp \
-    ../../src/algorithms/T2FMRF_UM.cpp \
-    ../../src/algorithms/T2FMRF_UV.cpp \
-    ../../src/algorithms/TwoPoints.cpp \
-    ../../src/algorithms/ViBe.cpp \
-    ../../src/algorithms/VuMeter.cpp \
-    ../../src/algorithms/WeightedMovingMean.cpp \
-    ../../src/algorithms/WeightedMovingVariance.cpp \
-    ../../src/algorithms/CodeBook.cpp
-    ../../src/algorithms/_template_/MyBGS.cpp \
+    texteditor.cpp
+SOURCES += $$files("../../src/algorithms/*.cpp", true)
+SOURCES += $$files("../../src/tools/*.cpp", true)
+SOURCES += $$files("../../src/utils/*.cpp", true)
 
 HEADERS  += mainwindow.h \
     qt_utils.h \
-    texteditor.h \
-    ../../src/utils/GenericKeys.h \
-    ../../src/utils/GenericMacros.h \
-    ../../src/utils/ILoadSaveConfig.h \
-    ../../src/tools/ForegroundMaskAnalysis.h \
-    ../../src/tools/PerformanceUtils.h \
-    ../../src/tools/PixelUtils.h \
-    ../../src/algorithms/dp/AdaptiveMedianBGS.h \
-    ../../src/algorithms/dp/Bgs.h \
-    ../../src/algorithms/dp/BgsParams.h \
-    ../../src/algorithms/dp/Eigenbackground.h \
-    ../../src/algorithms/dp/Error.h \
-    ../../src/algorithms/dp/GrimsonGMM.h \
-    ../../src/algorithms/dp/Image.h \
-    ../../src/algorithms/dp/MeanBGS.h \
-    ../../src/algorithms/dp/PratiMediodBGS.h \
-    ../../src/algorithms/dp/TextureBGS.h \
-    ../../src/algorithms/dp/WrenGA.h \
-    ../../src/algorithms/dp/ZivkovicAGMM.h \
-    ../../src/algorithms/IMBS/IMBS.hpp \
-    ../../src/algorithms/KDE/KernelTable.h \
-    ../../src/algorithms/KDE/NPBGmodel.h \
-    ../../src/algorithms/KDE/NPBGSubtractor.h \
-    ../../src/algorithms/lb/BGModel.h \
-    ../../src/algorithms/lb/BGModelFuzzyGauss.h \
-    ../../src/algorithms/lb/BGModelFuzzySom.h \
-    ../../src/algorithms/lb/BGModelGauss.h \
-    ../../src/algorithms/lb/BGModelMog.h \
-    ../../src/algorithms/lb/BGModelSom.h \
-    ../../src/algorithms/lb/Types.h \
-    ../../src/algorithms/LBP_MRF/block.h \
-    ../../src/algorithms/LBP_MRF/graph.h \
-    ../../src/algorithms/LBP_MRF/MEDefs.hpp \
-    ../../src/algorithms/LBP_MRF/MEHistogram.hpp \
-    ../../src/algorithms/LBP_MRF/MEImage.hpp \
-    ../../src/algorithms/LBP_MRF/MotionDetection.hpp \
-    ../../src/algorithms/LBSP/BackgroundSubtractorLBSP.h \
-    ../../src/algorithms/LBSP/BackgroundSubtractorLBSP_.h \
-    ../../src/algorithms/LBSP/BackgroundSubtractorLOBSTER.h \
-    ../../src/algorithms/LBSP/BackgroundSubtractorPAWCS.h \
-    ../../src/algorithms/LBSP/BackgroundSubtractorSuBSENSE.h \
-    ../../src/algorithms/LBSP/DistanceUtils.h \
-    ../../src/algorithms/LBSP/LBSP.h \
-    ../../src/algorithms/LBSP/LBSP_.h \
-    ../../src/algorithms/LBSP/RandUtils.h \
-    ../../src/algorithms/MultiLayer/BackgroundSubtractionAPI.h \
-    ../../src/algorithms/MultiLayer/BGS.h \
-    ../../src/algorithms/MultiLayer/blob.h \
-    ../../src/algorithms/MultiLayer/BlobExtraction.h \
-    ../../src/algorithms/MultiLayer/BlobLibraryConfiguration.h \
-    ../../src/algorithms/MultiLayer/BlobResult.h \
-    ../../src/algorithms/MultiLayer/CMultiLayerBGS.h \
-    ../../src/algorithms/MultiLayer/LocalBinaryPattern.h \
-    ../../src/algorithms/MultiLayer/OpenCvDataConversion.h \
-    ../../src/algorithms/MultiLayer/OpenCvLegacyIncludes.h \
-    ../../src/algorithms/PBAS/PBAS.h \
-    ../../src/algorithms/SigmaDelta/sdLaMa091.h \
-    ../../src/tools/FuzzyUtils.h \
-    ../../src/algorithms/T2F/MRF.h \
-    ../../src/algorithms/T2F/T2FGMM.h \
-    ../../src/algorithms/T2F/T2FMRF.h \
-    ../../src/algorithms/TwoPoints/two_points.h \
-    ../../src/algorithms/ViBe/vibe-background-sequential.h \
-    ../../src/algorithms/VuMeter/TBackground.h \
-    ../../src/algorithms/VuMeter/TBackgroundVuMeter.h \
-    ../../src/algorithms/AdaptiveBackgroundLearning.h \
-    ../../src/algorithms/AdaptiveSelectiveBackgroundLearning.h \
-    ../../src/algorithms/algorithms.h \
-    ../../src/algorithms/DPAdaptiveMedian.h \
-    ../../src/algorithms/DPEigenbackground.h \
-    ../../src/algorithms/DPGrimsonGMM.h \
-    ../../src/algorithms/DPMean.h \
-    ../../src/algorithms/DPPratiMediod.h \
-    ../../src/algorithms/DPTexture.h \
-    ../../src/algorithms/DPWrenGA.h \
-    ../../src/algorithms/DPZivkovicAGMM.h \
-    ../../src/algorithms/FrameDifference.h \
-    ../../src/algorithms/FuzzyChoquetIntegral.h \
-    ../../src/algorithms/FuzzySugenoIntegral.h \
-    ../../src/algorithms/GMG.h \
-    ../../src/algorithms/IBGS.h \
-    ../../src/algorithms/IndependentMultimodal.h \
-    ../../src/algorithms/KDE.h \
-    ../../src/algorithms/KNN.h \
-    ../../src/algorithms/LBAdaptiveSOM.h \
-    ../../src/algorithms/LBFuzzyAdaptiveSOM.h \
-    ../../src/algorithms/LBFuzzyGaussian.h \
-    ../../src/algorithms/LBMixtureOfGaussians.h \
-    ../../src/algorithms/LBP_MRF.h \
-    ../../src/algorithms/LBSimpleGaussian.h \
-    ../../src/algorithms/LOBSTER.h \
-    ../../src/algorithms/MixtureOfGaussianV1.h \
-    ../../src/algorithms/MixtureOfGaussianV2.h \
-    ../../src/algorithms/MultiCue.h \
-    ../../src/algorithms/MultiLayer.h \
-    ../../src/algorithms/PAWCS.h \
-    ../../src/algorithms/PixelBasedAdaptiveSegmenter.h \
-    ../../src/algorithms/SigmaDelta.h \
-    ../../src/algorithms/StaticFrameDifference.h \
-    ../../src/algorithms/SuBSENSE.h \
-    ../../src/algorithms/T2FGMM_UM.h \
-    ../../src/algorithms/T2FGMM_UV.h \
-    ../../src/algorithms/T2FMRF_UM.h \
-    ../../src/algorithms/T2FMRF_UV.h \
-    ../../src/algorithms/TwoPoints.h \
-    ../../src/algorithms/ViBe.h \
-    ../../src/algorithms/VuMeter.h \
-    ../../src/algorithms/WeightedMovingMean.h \
-    ../../src/algorithms/WeightedMovingVariance.h \
-    ../../src/algorithms/CodeBook.h
-    ../../src/algorithms/_template_/MyBGS.h \
+    texteditor.h
+HEADERS += $$files("../../src/algorithms/*.h", true)
+HEADERS += $$files("../../src/tools/*.h", true)
+HEADERS += $$files("../../src/utils/*.h", true)
 
 FORMS    += mainwindow.ui
 
diff --git a/gui/qt/mainwindow.cpp b/gui/qt/mainwindow.cpp
index 8565b9282d669112c0aa9a3165aad910f8ab6600..c2b7eeeac33798b6b0c0394e17b9e7b2ca2a45e3 100644
--- a/gui/qt/mainwindow.cpp
+++ b/gui/qt/mainwindow.cpp
@@ -137,6 +137,8 @@ MainWindow::MainWindow(QWidget *parent) :
   ui->listView_algorithms->setModel(listModel);
   QModelIndex index = listModel->index(0);
   ui->listView_algorithms->selectionModel()->select(index, QItemSelectionModel::Select);
+  //std::cout << "QDir::currentPath(): " + QDir::currentPath().toStdString() << std::endl;
+  //std::cout << "QCoreApplication::applicationDirPath(): " + QCoreApplication::applicationDirPath().toStdString() << std::endl;
 }
 
 MainWindow::~MainWindow()
@@ -289,7 +291,7 @@ void MainWindow::setFrameNumber(long long _frameNumber)
 {
   //std::cout << "setFrameNumber()" << std::endl;
   frameNumber = _frameNumber;
-  QString txt_frameNumber = QString::fromStdString(to_string(frameNumber));
+  QString txt_frameNumber = QString::fromStdString(to_string<long long>(frameNumber));
   ui->label_framenumber_txt->setText(txt_frameNumber);
 }
 
@@ -355,8 +357,8 @@ void MainWindow::startCapture()
   {
     int frame_width = cv_frame.size().width;
     int frame_height = cv_frame.size().height;
-    ui->label_frameresw_txt->setText(QString::fromStdString(to_string(frame_width)));
-    ui->label_frameresh_txt->setText(QString::fromStdString(to_string(frame_height)));
+    ui->label_frameresw_txt->setText(QString::fromStdString(to_string<int>(frame_width)));
+    ui->label_frameresh_txt->setText(QString::fromStdString(to_string<int>(frame_height)));
   }
 
   if (useVideo && capture_length > 0)
@@ -476,7 +478,8 @@ bool MainWindow::setUpCamera()
 
 bool MainWindow::setUpVideo()
 {
-  std::string videoFileName = fileName.toStdString();
+  //std::string videoFileName = fileName.toStdString();
+  std::string videoFileName = ui->lineEdit_inputdata->text().toStdString();
   std::cout << "Openning: " << videoFileName << std::endl;
   capture.open(videoFileName.c_str());
   return capture.isOpened();
@@ -555,7 +558,7 @@ void MainWindow::on_listView_algorithms_doubleClicked(const QModelIndex &index)
   }
   else
   {
-    QMessageBox::warning(this, "Warning", "XML configuration file not found!\nPlease run the algorithm first!");
+    QMessageBox::warning(this, "Warning", "XML configuration file not found!\nPlease run the algorithm first or create a config folder relative to the executable path.");
     return;
   }
 }
diff --git a/gui/qt/mainwindow.ui b/gui/qt/mainwindow.ui
index 75e9e61a8081a9417d138d40149e10b6f2e5ea00..5f1db75aa2bcb3b6af86cb107863bd61ff5836b6 100644
--- a/gui/qt/mainwindow.ui
+++ b/gui/qt/mainwindow.ui
@@ -82,7 +82,7 @@
    <widget class="QCheckBox" name="checkBox_webcamera">
     <property name="geometry">
      <rect>
-      <x>280</x>
+      <x>590</x>
       <y>60</y>
       <width>131</width>
       <height>20</height>
@@ -95,7 +95,7 @@
    <widget class="QSpinBox" name="spinBox_webcamera">
     <property name="geometry">
      <rect>
-      <x>410</x>
+      <x>720</x>
       <y>60</y>
       <width>42</width>
       <height>20</height>
@@ -105,7 +105,7 @@
    <widget class="QCheckBox" name="checkBox_imageseq">
     <property name="geometry">
      <rect>
-      <x>470</x>
+      <x>770</x>
       <y>60</y>
       <width>151</width>
       <height>20</height>
@@ -600,6 +600,32 @@
      <bool>true</bool>
     </property>
    </widget>
+   <widget class="QLabel" name="label_config">
+    <property name="geometry">
+     <rect>
+      <x>280</x>
+      <y>60</y>
+      <width>91</width>
+      <height>23</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Config folder</string>
+    </property>
+   </widget>
+   <widget class="QLineEdit" name="lineEdit_config">
+    <property name="geometry">
+     <rect>
+      <x>280</x>
+      <y>90</y>
+      <width>641</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>./config</string>
+    </property>
+   </widget>
   </widget>
   <widget class="QMenuBar" name="menuBar">
    <property name="geometry">
@@ -607,7 +633,7 @@
      <x>0</x>
      <y>0</y>
      <width>1070</width>
-     <height>26</height>
+     <height>22</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuBGSLibrary">