diff --git a/README.md b/README.md
index 690b1cd094e0a8ae72f7667df13b3fcfd04ab4e0..d127bb6f64221c866f5f8b4bf784c928b2328c7d 100644
--- a/README.md
+++ b/README.md
@@ -61,7 +61,7 @@ Performance is nearly identical to the closed source paid miners. Here are some
 * **Dual E5640** - 365 H/s (same as above)
 
 ## Default dev donation
-By default the miner will donate 2% of the hashpower (2 minute in 100 minutes) to my pool. If you want to change that, edit **donate-level.h** before you build the binaries.
+By default the miner will donate 2% of the hashpower (2 minute in 100 minutes) to my pool. If you want to change that, edit **xmrstak/donate-level.hpp** before you build the binaries.
 
 If you want to donate directly to support further development, here is my wallet
 
diff --git a/xmrstak/backend/amd/amd_gpu/gpu.cpp b/xmrstak/backend/amd/amd_gpu/gpu.cpp
index 04e442a1d603459dac5050366ebfd6a7a5ec060c..deb0fc7f9c54b516add55ec351be5ef61d310708 100644
--- a/xmrstak/backend/amd/amd_gpu/gpu.cpp
+++ b/xmrstak/backend/amd/amd_gpu/gpu.cpp
@@ -23,7 +23,6 @@
 
 #ifdef _WIN32
 #include <windows.h>
-const char* sSourcePath = "opencl\\cryptonight.cl";
 
 static inline void port_sleep(size_t sec)
 {
@@ -31,7 +30,6 @@ static inline void port_sleep(size_t sec)
 }
 #else
 #include <unistd.h>
-const char* sSourcePath = "opencl/cryptonight.cl";
 
 static inline void port_sleep(size_t sec)
 {
@@ -46,7 +44,7 @@ static inline long long unsigned int int_port(size_t i)
 }
 #endif
 
-#include "gpu.h"
+#include "gpu.hpp"
 
 const char* err_to_str(cl_int ret)
 {
diff --git a/xmrstak/backend/amd/amd_gpu/gpu.hpp b/xmrstak/backend/amd/amd_gpu/gpu.hpp
index 8a71cfafb6e421c8a672603a37741378975a8957..5ff7ea17bb01d1288db2b3c49076aedda9872c58 100644
--- a/xmrstak/backend/amd/amd_gpu/gpu.hpp
+++ b/xmrstak/backend/amd/amd_gpu/gpu.hpp
@@ -1,5 +1,7 @@
 #pragma once
 
+#include "xmrstak/misc/console.hpp"
+
 #if defined(__APPLE__)
 #include <OpenCL/cl.h>
 #else
@@ -8,7 +10,6 @@
 
 #include <stdint.h>
 #include <vector>
-#include "../../../console.h"
 
 #define ERR_SUCCESS (0)
 #define ERR_OCL_API (2)
diff --git a/xmrstak/backend/amd/autoAdjust.hpp b/xmrstak/backend/amd/autoAdjust.hpp
index 442d8f16ff1dad5aa6df1cd485ccbf854d88eff5..84541ae10d2ec88de0b948b1797841813928e284 100644
--- a/xmrstak/backend/amd/autoAdjust.hpp
+++ b/xmrstak/backend/amd/autoAdjust.hpp
@@ -1,14 +1,13 @@
 
 #pragma once
 
+#include "amd_gpu/gpu.hpp"
 #include "autoAdjust.hpp"
+#include "jconf.hpp"
 
-
-#include "jconf.h"
-#include "../../console.h"
-#include "../../ConfigEditor.hpp"
-#include "amd_gpu/gpu.h"
-#include "../../Params.hpp"
+#include "xmrstak/misc/console.hpp"
+#include "xmrstak/misc/configEditor.hpp"
+#include "xmrstak/params.hpp"
 
 #include <vector>
 #include <cstdio>
diff --git a/xmrstak/backend/amd/jconf.cpp b/xmrstak/backend/amd/jconf.cpp
index f8a551e2fd6023cbb32026775970a0661520e035..2132ebf2c7b0359c77d7d91460c9278bfe7f46ff 100644
--- a/xmrstak/backend/amd/jconf.cpp
+++ b/xmrstak/backend/amd/jconf.cpp
@@ -22,11 +22,9 @@
   */
 
 
-#include "jconf.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "jconf.hpp"
+#include "xmrstak/misc/jext.hpp"
+#include "xmrstak/misc/console.hpp"
 
 #ifdef _WIN32
 #define strcasecmp _stricmp
@@ -35,10 +33,10 @@
 #include <cpuid.h>
 #endif
 
-#include "../../rapidjson/document.h"
-#include "../../rapidjson/error/en.h"
-#include "../../jext.h"
-#include "../../console.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
 
 namespace xmrstak
 {
diff --git a/xmrstak/backend/amd/jconf.hpp b/xmrstak/backend/amd/jconf.hpp
index 9fef331e9cd700c9363b5612f6583dc4e1735c45..db41dffb47f70130a7f8d3773fd065b6b91140e2 100644
--- a/xmrstak/backend/amd/jconf.hpp
+++ b/xmrstak/backend/amd/jconf.hpp
@@ -1,7 +1,9 @@
 #pragma once
+
+#include "xmrstak/params.hpp"
+
 #include <stdlib.h>
 #include <string>
-#include "../../Params.hpp"
 
 namespace xmrstak
 {
diff --git a/xmrstak/backend/amd/minethd.cpp b/xmrstak/backend/amd/minethd.cpp
index f2f5ff41ff1360c4e1d3e847f281293f1bab5f28..b2f56200ce44ba7c5a9ecd9737f2e69d7d611b21 100644
--- a/xmrstak/backend/amd/minethd.cpp
+++ b/xmrstak/backend/amd/minethd.cpp
@@ -21,28 +21,25 @@
   *
   */
 
+#include "minethd.hpp"
+#include "autoAdjust.hpp"
+#include "amd_gpu/gpu.hpp"
+
+#include "xmrstak/backend/cpu/crypto/cryptonight_aesni.h"
+#include "xmrstak/backend/cpu/crypto/cryptonight.h"
+#include "xmrstak/misc/configEditor.hpp"
+#include "xmrstak/misc/console.hpp"
+#include "xmrstak/backend/cpu/minethd.hpp"
+#include "xmrstak/jconf.hpp"
+#include "xmrstak/misc/executor.hpp"
+#include "xmrstak/misc/environment.hpp"
+#include "xmrstak/params.hpp"
+
 #include <assert.h>
 #include <cmath>
 #include <chrono>
 #include <thread>
-
-#include "../../ConfigEditor.hpp"
-#include "autoAdjust.hpp"
-
 #include <vector>
-#include "../../console.h"
-#include "../../crypto/cryptonight_aesni.h"
-#include "../cpu/minethd.h"
-#include "../../jconf.h"
-
-#include "../../executor.h"
-#include "minethd.h"
-#include "../../jconf.h"
-#include "../../crypto/cryptonight.h"
-#include "../../Environment.hpp"
-#include "../../Params.hpp"
-#include "amd_gpu/gpu.h"
-
 
 namespace xmrstak
 {
diff --git a/xmrstak/backend/amd/minethd.hpp b/xmrstak/backend/amd/minethd.hpp
index 4fb3b130389920aa8be922c33420adc54f58e85d..7e710823a84ba578060bcced9669c3f60b4b1da0 100644
--- a/xmrstak/backend/amd/minethd.hpp
+++ b/xmrstak/backend/amd/minethd.hpp
@@ -1,11 +1,12 @@
 #pragma once
+
+#include "amd_gpu/gpu.hpp"
+#include "jconf.hpp"
+#include "xmrstak/backend/iBackend.hpp"
+#include "xmrstak/misc/environment.hpp"
+
 #include <thread>
 #include <atomic>
-#include "./jconf.h"
-#include "../IBackend.hpp"
-#include "../../Environment.hpp"
-
-#include "amd_gpu/gpu.h"
 
 namespace xmrstak
 {
diff --git a/xmrstak/backend/backendConnector.cpp b/xmrstak/backend/backendConnector.cpp
index 1013f794164621018b5a84bc559170bcd7f50025..d07b54d9cf6a00bc6a00cde4a783e567191025bb 100644
--- a/xmrstak/backend/backendConnector.cpp
+++ b/xmrstak/backend/backendConnector.cpp
@@ -21,6 +21,24 @@
   *
   */
 
+#include "iBackend.hpp"
+#include "backendConnector.hpp"
+#include "miner_work.hpp"
+#include "globalStates.hpp"
+#include "plugin.hpp"
+#include "xmrstak/misc/environment.hpp"
+#include "xmrstak/misc/console.hpp"
+#include "xmrstak/params.hpp"
+
+#include "cpu/minethd.hpp"
+#ifndef CONF_NO_CUDA
+#	include "nvidia/minethd.hpp"
+#endif
+#ifndef CONF_NO_OPENCL
+#	include "amd/minethd.hpp"
+#endif
+
+#include <cstdlib>
 #include <assert.h>
 #include <cmath>
 #include <chrono>
@@ -28,29 +46,10 @@
 #include <thread>
 #include <bitset>
 
-#include "IBackend.hpp"
-#include "BackendConnector.hpp"
-
-#include "cpu/minethd.h"
-#ifndef CONF_NO_CUDA
-#	include "nvidia/minethd.h"
-#endif
-#ifndef CONF_NO_OPENCL
-#	include "amd/minethd.h"
-#endif
-#include "miner_work.h"
-#include "GlobalStates.hpp"
- #include <cstdlib>
-
-#include "Plugin.hpp"
-#include "../Environment.hpp"
-#include "../console.h"
-#include "../Params.hpp"
 
 namespace xmrstak
 {
 
-
 bool BackendConnector::self_test()
 {
 	
diff --git a/xmrstak/backend/backendConnector.hpp b/xmrstak/backend/backendConnector.hpp
index 024d9b10097232166d564728a1d04e223888ade0..f573abcd154fabc3b74015d2361eebf57e3bbbe6 100644
--- a/xmrstak/backend/backendConnector.hpp
+++ b/xmrstak/backend/backendConnector.hpp
@@ -1,10 +1,13 @@
 #pragma once
+
+#include "iBackend.hpp"
+#include "miner_work.hpp"
+
 #include <thread>
 #include <vector>
 #include <atomic>
 #include <mutex>
-#include "IBackend.hpp"
-#include "miner_work.h"
+
 
 namespace xmrstak
 {
diff --git a/xmrstak/backend/cpu/autoAdjust.hpp b/xmrstak/backend/cpu/autoAdjust.hpp
index 32c85760156029544f496c929802e4ae67c9c0b1..f686224bf70a4f305a6de2c51b0659e636f9fd36 100644
--- a/xmrstak/backend/cpu/autoAdjust.hpp
+++ b/xmrstak/backend/cpu/autoAdjust.hpp
@@ -1,9 +1,11 @@
 #pragma once
-#include "jconf.h"
-#include "../../console.h"
-#include "../../jconf.h"
-#include "../../ConfigEditor.hpp"
-#include "../../Params.hpp"
+
+#include "jconf.hpp"
+
+#include "xmrstak/misc/console.hpp"
+#include "xmrstak/jconf.hpp"
+#include "xmrstak/misc/configEditor.hpp"
+#include "xmrstak/params.hpp"
 #include <string>
 
 #ifdef _WIN32
diff --git a/xmrstak/backend/cpu/autoAdjustHwloc.hpp b/xmrstak/backend/cpu/autoAdjustHwloc.hpp
index e1916e0b86f6e0230836df65002274cfe51ae60b..055a7f54994019e1f30165cc21d6c83ff3cefe4a 100644
--- a/xmrstak/backend/cpu/autoAdjustHwloc.hpp
+++ b/xmrstak/backend/cpu/autoAdjustHwloc.hpp
@@ -1,9 +1,8 @@
 #pragma once
 
-#include "../../console.h"
-#include <hwloc.h>
-#include <stdio.h>
-#include "../../Params.hpp"
+#include "xmrstak/misc/console.hpp"
+#include "xmrstak/misc/configEditor.hpp"
+#include "xmrstak/params.hpp"
 
 #ifdef _WIN32
 #include <windows.h>
@@ -12,7 +11,10 @@
 #endif // _WIN32
 
 #include <string>
-#include "../../ConfigEditor.hpp"
+
+#include <hwloc.h>
+#include <stdio.h>
+
 
 namespace xmrstak
 {
diff --git a/xmrstak/backend/cpu/hwlocMemory.hpp b/xmrstak/backend/cpu/hwlocMemory.hpp
index f471951de3207794dd6b7d3532204e9fd2624ae4..719c1bbc2f0dd20563cb86f195ac723f4bd0334b 100644
--- a/xmrstak/backend/cpu/hwlocMemory.hpp
+++ b/xmrstak/backend/cpu/hwlocMemory.hpp
@@ -1,6 +1,6 @@
 #pragma once
 
-#include "console.h"
+#include "xmrstak/misc/console.hpp"
 
 #ifndef CONF_NO_HWLOC
 
diff --git a/xmrstak/backend/cpu/jconf.cpp b/xmrstak/backend/cpu/jconf.cpp
index 021d6077462eb94129b7de9118b52ee759e333d4..2ded8c05ce5d8e50bfa6ddeb50c1e95f69dfdf14 100644
--- a/xmrstak/backend/cpu/jconf.cpp
+++ b/xmrstak/backend/cpu/jconf.cpp
@@ -21,13 +21,14 @@
   *
   */
 
-#include "jconf.h"
-#include "../../console.h"
-#include <iostream>
+#include "jconf.hpp"
+#include "xmrstak/misc/console.hpp"
+#include "xmrstak/misc/jext.hpp"
 
+#include <iostream>
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
+#include <string>
 
 #ifdef _WIN32
 #define strcasecmp _stricmp
@@ -36,9 +37,6 @@
 #include <cpuid.h>
 #endif
 
-#include "../../rapidjson/document.h"
-#include "../../rapidjson/error/en.h"
-#include "../../jext.h"
 
 namespace xmrstak
 {
diff --git a/xmrstak/backend/cpu/jconf.hpp b/xmrstak/backend/cpu/jconf.hpp
index 1f9276575921ac19aa6eb032b42a7e2b90bb6166..03dfcc181c8b590a14758520e5dc2f282c6dc7b4 100644
--- a/xmrstak/backend/cpu/jconf.hpp
+++ b/xmrstak/backend/cpu/jconf.hpp
@@ -1,7 +1,9 @@
 #pragma once
+
+#include "xmrstak/params.hpp"
+
 #include <stdlib.h>
 #include <string>
-#include "../../Params.hpp"
 
 namespace xmrstak
 {
diff --git a/xmrstak/backend/cpu/minethd.cpp b/xmrstak/backend/cpu/minethd.cpp
index 3ffdf994b2fc35a8d42aceddddc08a3a63e5cf06..603716192746626e1bfea36291763797dc589531 100644
--- a/xmrstak/backend/cpu/minethd.cpp
+++ b/xmrstak/backend/cpu/minethd.cpp
@@ -27,19 +27,19 @@
 #include <cstring>
 #include <thread>
 #include <bitset>
-#include "../../console.h"
-#include "../IBackend.hpp"
-#include "../GlobalStates.hpp"
-#include "../../ConfigEditor.hpp"
-#include "../../Params.hpp"
-#include "../../jconf.h"
-
-#include "../../executor.h"
-#include "minethd.h"
-#include "./jconf.h"
-#include "../../crypto/cryptonight_aesni.h"
-#include "../../hwlocMemory.hpp"
-#include "../miner_work.h"
+#include "xmrstak/misc/console.hpp"
+#include "xmrstak/backend/iBackend.hpp"
+#include "xmrstak/backend//globalStates.hpp"
+#include "xmrstak/misc/configEditor.hpp"
+#include "xmrstak/params.hpp"
+#include "xmrstak/jconf.hpp"
+
+#include "xmrstak/misc/executor.hpp"
+#include "minethd.hpp"
+#include "xmrstak/jconf.hpp"
+#include "xmrstak/backend/crypto/cryptonight_aesni.h"
+#include "hwlocMemory.hpp"
+#include "xmrstak/backend/miner_work.hpp"
 
 #ifndef CONF_NO_HWLOC
 #   include "autoAdjustHwloc.hpp"
diff --git a/xmrstak/backend/cpu/minethd.hpp b/xmrstak/backend/cpu/minethd.hpp
index 40383cfdf254ea64d63096a0673413c5e167bea4..1dcca86c63a5b80074708df738bf027505837a4c 100644
--- a/xmrstak/backend/cpu/minethd.hpp
+++ b/xmrstak/backend/cpu/minethd.hpp
@@ -1,13 +1,15 @@
 #pragma once
+
+#include "crypto/cryptonight.h"
+#include "xmrstak/backend/miner_work.hpp"
+#include "xmrstak/backend/iBackend.hpp"
+#include "xmrstak/backend/globalStates.hpp"
+
+#include <iostream>
 #include <thread>
 #include <vector>
 #include <atomic>
 #include <mutex>
-#include "../../crypto/cryptonight.h"
-#include "../miner_work.h"
-#include "../IBackend.hpp"
-#include "../GlobalStates.hpp"
-#include <iostream>
 
 namespace xmrstak
 {
diff --git a/xmrstak/backend/globalStates.cpp b/xmrstak/backend/globalStates.cpp
index 5251da8fcec8c73f7af77ba421d8ed8e0f91f82f..ef582c1257a1fd8723bfaba5de627cc569af9c35 100644
--- a/xmrstak/backend/globalStates.cpp
+++ b/xmrstak/backend/globalStates.cpp
@@ -21,15 +21,15 @@
   *
   */
 
+#include "miner_work.hpp"
+#include "globalStates.hpp"
+
 #include <assert.h>
 #include <cmath>
 #include <chrono>
 #include <cstring>
 
 
-#include "miner_work.h"
-#include "GlobalStates.hpp"
-
 namespace xmrstak
 {
 
diff --git a/xmrstak/backend/globalStates.hpp b/xmrstak/backend/globalStates.hpp
index a9818baa46a550c53abd13d1a26458164ce81c5b..58248bd24781de4520b5f30266e0db5de728ca85 100644
--- a/xmrstak/backend/globalStates.hpp
+++ b/xmrstak/backend/globalStates.hpp
@@ -1,7 +1,10 @@
 #pragma once
+
+#include "miner_work.hpp"
+#include "xmrstak/misc/environment.hpp"
+
 #include <atomic>
-#include "miner_work.h"
-#include "../Environment.hpp"
+
 
 namespace xmrstak
 {
diff --git a/xmrstak/backend/miner_work.hpp b/xmrstak/backend/miner_work.hpp
index 8349fda39040a31e5d15f94c30f0bf161c42582e..c4715469451fd08be3baaec5dba695a2134aba29 100644
--- a/xmrstak/backend/miner_work.hpp
+++ b/xmrstak/backend/miner_work.hpp
@@ -1,4 +1,5 @@
 #pragma once
+
 #include <thread>
 #include <atomic>
 #include <mutex>
diff --git a/xmrstak/backend/nvidia/autoAdjust.hpp b/xmrstak/backend/nvidia/autoAdjust.hpp
index 84c6dfc4b745ec57a05dba2bc9e2fb7f7d3bc693..4107510f883a159a2cb6223140852c46af26c1fe 100644
--- a/xmrstak/backend/nvidia/autoAdjust.hpp
+++ b/xmrstak/backend/nvidia/autoAdjust.hpp
@@ -3,11 +3,11 @@
 
 #include "autoAdjust.hpp"
 
-#include "nvcc_code/cryptonight.h"
-#include "jconf.h"
-#include "../../console.h"
-#include "../../ConfigEditor.hpp"
-#include "../../Params.hpp"
+#include "nvcc_code/cryptonight.hpp"
+#include "jconf.hpp"
+#include "xmrstak/misc/console.hpp"
+#include "xmrstak/misc/configEditor.hpp"
+#include "xmrstak/params.hpp"
 
 #include <vector>
 #include <cstdio>
diff --git a/xmrstak/backend/nvidia/jconf.cpp b/xmrstak/backend/nvidia/jconf.cpp
index 2184acd5d18c80ab4cbd8559d6caf8b01464e2ab..7a94d194f13fd93b4367bb05707464173d014f0b 100644
--- a/xmrstak/backend/nvidia/jconf.cpp
+++ b/xmrstak/backend/nvidia/jconf.cpp
@@ -21,7 +21,9 @@
   *
   */
 
-#include "jconf.h"
+#include "jconf.hpp"
+#include "xmrstak/miscjext.hpp"
+#include "xmrstak/misc/console.hpp"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -34,10 +36,6 @@
 #include <cpuid.h>
 #endif
 
-#include "../../rapidjson/document.h"
-#include "../../rapidjson/error/en.h"
-#include "../../jext.h"
-#include "../../console.h"
 
 namespace xmrstak
 {
diff --git a/xmrstak/backend/nvidia/jconf.hpp b/xmrstak/backend/nvidia/jconf.hpp
index 8959088e5f2d96b6f5115507f8e0d1e315b97d95..2093408e56d053c83abdceac358d0df3ca10dc5c 100644
--- a/xmrstak/backend/nvidia/jconf.hpp
+++ b/xmrstak/backend/nvidia/jconf.hpp
@@ -1,7 +1,7 @@
 #pragma once
 #include <stdlib.h>
 #include <string>
-#include "../../Params.hpp"
+#include "xmrstak/params.hpp"
 
 namespace xmrstak
 {
diff --git a/xmrstak/backend/nvidia/minethd.cpp b/xmrstak/backend/nvidia/minethd.cpp
index cbee219dbffec3b1cc5b3ffb095177a9b473a2c2..7718d3495c018df3a962a65b97b04834b13f896b 100644
--- a/xmrstak/backend/nvidia/minethd.cpp
+++ b/xmrstak/backend/nvidia/minethd.cpp
@@ -21,24 +21,23 @@
   *
   */
 
+#include "minethd.hpp"
+#include "autoAdjust.hpp"
+#include "xmrstak/misc/console.hpp"
+#include "xmrstak/backend/cpu/crypto/cryptonight_aesni.h"
+#include "xmrstak/backend/cpu/crypto/cryptonight.h"
+#include "xmrstak/backend/cpu//cpu/minethd.hpp"
+#include "xmrstak/params.hpp"
+#include "xmrstak/misc/executor.hpp"
+#include "xmrstak/jconf.hpp"
+#include "xmrstak/misc/environment.hpp"
+
 #include <assert.h>
 #include <cmath>
 #include <chrono>
 #include <thread>
 #include <bitset>
 #include <vector>
-#include "../../console.h"
-#include "../../crypto/cryptonight_aesni.h"
-#include "../cpu/minethd.h"
-#include "../../Params.hpp"
-
-#include "../../executor.h"
-#include "minethd.h"
-#include "../../jconf.h"
-#include "../../crypto/cryptonight.h"
-#include "../../Environment.hpp"
-#include "autoAdjust.hpp"
-
 
 #ifndef USE_PRECOMPILED_HEADERS
 #ifdef WIN32
diff --git a/xmrstak/backend/nvidia/minethd.hpp b/xmrstak/backend/nvidia/minethd.hpp
index 9f3993ea077ce3048cc15ed331d90fb1db0aba98..ecf189a16881ce15eb8565f998000986002b03af 100644
--- a/xmrstak/backend/nvidia/minethd.hpp
+++ b/xmrstak/backend/nvidia/minethd.hpp
@@ -1,14 +1,18 @@
 #pragma once
+
+#include "xmrstak/jconf.hpp"
+#include "jconf.hpp"
+#include "nvcc_code/cryptonight.h"
+
+#include "xmrstak/bakcend/cpu/crypto/cryptonight.h"
+#include "xmrstak/backend/iBackend.hpp"
+#include "xmrstak/misc/environment.hpp"
+
+#include <iostream>
 #include <thread>
 #include <atomic>
 #include <vector>
-#include "nvcc_code/cryptonight.h"
-#include "../../crypto/cryptonight.h"
-#include "../../jconf.h"
-#include "./jconf.h"
-#include "../IBackend.hpp"
-#include "../../Environment.hpp"
-#include <iostream>
+
 
 namespace xmrstak
 {
diff --git a/xmrstak/backend/nvidia/nvcc_code/cuda_core.cu b/xmrstak/backend/nvidia/nvcc_code/cuda_core.cu
index 7590cf55baf80e387754f24c375e327b9cfba057..0c086e8a935119230d3c76f4a2ef68539e196f41 100644
--- a/xmrstak/backend/nvidia/nvcc_code/cuda_core.cu
+++ b/xmrstak/backend/nvidia/nvcc_code/cuda_core.cu
@@ -49,8 +49,8 @@ extern "C" void compat_usleep(uint64_t waitTime)
 }
 #endif
 
-#include "cryptonight.h"
-#include "cuda_extra.h"
+#include "cryptonight.hpp"
+#include "cuda_extra.hpp"
 #include "cuda_aes.hpp"
 #include "cuda_device.hpp"
 
diff --git a/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu b/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu
index 7052bc8b741372420a99badb8695ba163fef23e8..773447351b49a0b6de7a928771c6d204e208ede5 100644
--- a/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu
+++ b/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu
@@ -25,8 +25,8 @@ uint64_t keccakf_rndc[24] ={
 typedef unsigned char BitSequence;
 typedef unsigned long long DataLength;
 
-#include "cryptonight.h"
-#include "cuda_extra.h"
+#include "cryptonight.hpp"
+#include "cuda_extra.hpp"
 #include "cuda_keccak.hpp"
 #include "cuda_blake.hpp"
 #include "cuda_groestl.hpp"
diff --git a/xmrstak/backend/plugin.hpp b/xmrstak/backend/plugin.hpp
index 9ba9716971710c1b23270849d83d6fb110c9a22b..38f8e5340ed8cf96b37a63c537109794236635d8 100644
--- a/xmrstak/backend/plugin.hpp
+++ b/xmrstak/backend/plugin.hpp
@@ -1,21 +1,23 @@
 #pragma once
+
+#include "xmrstak/misc/environment.hpp"
+
 #include <thread>
 #include <atomic>
 #include <vector>
 #include <string>
-#include "IBackend.hpp"
+#include "iBackend.hpp"
 #include <iostream>
-#include "../Environment.hpp"
 
 #ifndef USE_PRECOMPILED_HEADERS
-#ifdef WIN32
-#include <direct.h>
-#include <windows.h>
-#else
-#include <sys/types.h>
-#include <dlfcn.h>
-#endif
-#include <iostream>
+#	ifdef WIN32
+#		include <direct.h>
+#		include <windows.h>
+#	else
+#		include <sys/types.h>
+#		include <dlfcn.h>
+#	endif
+#	include <iostream>
 #endif
 
 namespace xmrstak
diff --git a/xmrstak/cli/cli-miner.cpp b/xmrstak/cli/cli-miner.cpp
index f2c5c1d736d4d562de41598307401360b1e7ca40..2941792e025513ba4cc56d567faffcdef1c025bb 100644
--- a/xmrstak/cli/cli-miner.cpp
+++ b/xmrstak/cli/cli-miner.cpp
@@ -21,27 +21,25 @@
   *
   */
 
-#include "../executor.h"
-#include "../backend/miner_work.h"
-#include "../backend/GlobalStates.hpp"
-#include "../backend/BackendConnector.hpp"
-#include "../jconf.h"
-#include "../console.h"
-#include "../donate-level.h"
-#include "../Params.hpp"
-#include "../ConfigEditor.hpp"
-
-#include "../version.h"
+#include "xmrstak/misc/executor.hpp"
+#include "xmrstak/backend/miner_work.hpp"
+#include "xmrstak/backend/globalStates.hpp"
+#include "xmrstak/backend/backendConnector.hpp"
+#include "xmrstak/jconf.hpp"
+#include "xmrstak/misc/console.hpp"
+#include "xmrstak/donate-level.hpp"
+#include "xmrstak/params.hpp"
+#include "xmrstak/misc/configEditor.hpp"
+#include "xmrstak/version.hpp"
 
 #ifndef CONF_NO_HTTPD
-#	include "../httpd.h"
+#	include "xmrstak/http//httpd.hpp"
 #endif
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <string>
 #include <iostream>
-
 #include <time.h>
 
 #ifndef CONF_NO_TLS
diff --git a/xmrstak/http/httpd.cpp b/xmrstak/http/httpd.cpp
index 53b73f171d1cde9031955f0eae15ec9724b32822..a112bbbb28bfa17344148f27a8bd2dde2c5a4124 100644
--- a/xmrstak/http/httpd.cpp
+++ b/xmrstak/http/httpd.cpp
@@ -23,19 +23,19 @@
 
 #ifndef CONF_NO_HTTPD
 
+
+#include "httpd.hpp"
+#include "webdesign.hpp"
+#include "xmrstak/net/msgstruct.hpp"
+#include "xmrstak/misc/console.hpp"
+#include "xmrstak/misc/executor.hpp"
+#include "xmrstak/jconf.hpp"
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <string>
 
-#include "msgstruct.h"
-#include "httpd.h"
-#include "console.h"
-#include "executor.h"
-#include "jconf.h"
-
-#include "webdesign.h"
-
 #include <microhttpd.h>
 #ifdef _WIN32
 #define strcasecmp _stricmp
diff --git a/xmrstak/http/httpd.hpp b/xmrstak/http/httpd.hpp
index bc8bcf612c173a3096a3f09bba2dfb5b8b670379..3836968d7ff2985cf28116de9fa3d9f94f1a0769 100644
--- a/xmrstak/http/httpd.hpp
+++ b/xmrstak/http/httpd.hpp
@@ -1,5 +1,7 @@
 #pragma once
 
+#include <stdlib.h>
+
 struct MHD_Daemon;
 struct MHD_Connection;
 
diff --git a/xmrstak/jconf.cpp b/xmrstak/jconf.cpp
index bfa262699c40567c17922ec0512608cf8625ec25..cb90febbb2de5607450620bc4c95155abbdb453e 100644
--- a/xmrstak/jconf.cpp
+++ b/xmrstak/jconf.cpp
@@ -21,8 +21,12 @@
   *
   */
 
-#include "jconf.h"
-#include "console.h"
+#include "jconf.hpp"
+#include "params.hpp"
+
+#include "xmrstak/misc/console.hpp"
+#include "xmrstak/misc/jext.hpp"
+#include "xmrstak/misc/console.hpp"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -35,11 +39,6 @@
 #include <cpuid.h>
 #endif
 
-#include "rapidjson/document.h"
-#include "rapidjson/error/en.h"
-#include "jext.h"
-#include "console.h"
-#include "Params.hpp"
 
 using namespace rapidjson;
 
diff --git a/xmrstak/jconf.hpp b/xmrstak/jconf.hpp
index 934d6f82f32e0cbee8f43bd3aa15a722737ea268..41c771251424e1299a9129eb00b391c4e9b2b022 100644
--- a/xmrstak/jconf.hpp
+++ b/xmrstak/jconf.hpp
@@ -1,8 +1,11 @@
 #pragma once
+
+#include "xmrstak/misc/environment.hpp"
+#include "params.hpp"
+
 #include <stdlib.h>
 #include <string>
-#include "Environment.hpp"
-#include "Params.hpp"
+
 
 class jconf
 {
diff --git a/xmrstak/misc/console.cpp b/xmrstak/misc/console.cpp
index 0c73b1da14704cfdf98577e471ab49b10a343d0e..ba34bb33995667f98152010c460f1a6efad59928 100644
--- a/xmrstak/misc/console.cpp
+++ b/xmrstak/misc/console.cpp
@@ -21,7 +21,8 @@
   *
   */
 
-#include "console.h"
+#include "xmrstak/misc/console.hpp"
+
 #include <time.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/xmrstak/misc/console.hpp b/xmrstak/misc/console.hpp
index ac2ed3c9445478b25c33f7617f18e60169c4af07..c68bba34cd639df58d3c8ce607c0a09d946c6c59 100644
--- a/xmrstak/misc/console.hpp
+++ b/xmrstak/misc/console.hpp
@@ -1,6 +1,9 @@
 #pragma once
+
+#include "xmrstak/misc/environment.hpp"
+
 #include <mutex>
-#include "Environment.hpp"
+
 
 enum out_colours { K_RED, K_GREEN, K_BLUE, K_YELLOW, K_CYAN, K_MAGENTA, K_WHITE, K_NONE };
 
diff --git a/xmrstak/misc/executor.cpp b/xmrstak/misc/executor.cpp
index 64f3d406c643d72465cf78c22d3446b500999e2b..455412ed0edc959c4d4eec607b2cda88f37288a7 100644
--- a/xmrstak/misc/executor.cpp
+++ b/xmrstak/misc/executor.cpp
@@ -21,24 +21,25 @@
   *
   */
 
+#include "executor.hpp"
+#include "xmrstak/net/jpsock.hpp"
+
+#include "telemetry.hpp"
+#include "xmrstak/backend/miner_work.hpp"
+#include "xmrstak/backend/globalStates.hpp"
+#include "xmrstak/backend/backendConnector.hpp"
+
+#include "xmrstak/jconf.hpp"
+#include "xmrstak/misc/console.hpp"
+#include "xmrstak/donate-level.hpp"
+#include "xmrstak/http/webdesign.hpp"
+
 #include <thread>
 #include <string>
 #include <cmath>
 #include <algorithm>
 #include <assert.h>
 #include <time.h>
-#include "executor.h"
-#include "jpsock.h"
-
-#include "telemetry.h"
-#include "backend/miner_work.h"
-#include "backend/GlobalStates.hpp"
-#include "backend/BackendConnector.hpp"
-
-#include "jconf.h"
-#include "console.h"
-#include "donate-level.h"
-#include "webdesign.h"
 
 #ifdef _WIN32
 #define strncasecmp _strnicmp
diff --git a/xmrstak/misc/executor.hpp b/xmrstak/misc/executor.hpp
index a3a0828ab9c938fbd89941c9f337dc94b6fa1ded..8be5f56b097915a426b4938dfa1ba2e164626108 100644
--- a/xmrstak/misc/executor.hpp
+++ b/xmrstak/misc/executor.hpp
@@ -1,16 +1,18 @@
 #pragma once
+
 #include "thdq.hpp"
-#include "msgstruct.h"
+#include "telemetry.hpp"
+#include "xmrstak/backend/iBackend.hpp"
+#include "xmrstak/misc/environment.hpp"
+#include "xmrstak/net/msgstruct.hpp"
+
 #include <atomic>
 #include <array>
 #include <list>
 #include <future>
-#include "telemetry.h"
-#include "backend/IBackend.hpp"
-#include "Environment.hpp"
 
-class jpsock;
 
+class jpsock;
 
 namespace xmrstak
 {
diff --git a/xmrstak/misc/jext.hpp b/xmrstak/misc/jext.hpp
index dce73a0e9d8a3153c42288642c29ac847d590e3c..f4a333c220f23493666da340bf9473b8dfdcbc13 100644
--- a/xmrstak/misc/jext.hpp
+++ b/xmrstak/misc/jext.hpp
@@ -1,5 +1,8 @@
 #pragma once
 
+#include "xmrstak/rapidjson/document.h"
+#include "xmrstak/rapidjson/error/en.h"
+
 using namespace rapidjson;
 
 /* This macro brings rapidjson more in line with other libs */
diff --git a/xmrstak/misc/telemetry.cpp b/xmrstak/misc/telemetry.cpp
index fafccd58fb1b64298b8175436ed12895424107ad..c5cce23acc0d28c26e7d2138b1e03bcb4ec96a62 100644
--- a/xmrstak/misc/telemetry.cpp
+++ b/xmrstak/misc/telemetry.cpp
@@ -21,10 +21,12 @@
   *
   */
 
+#include "telemetry.hpp"
+
 #include <cmath>
 #include <cstring>
 #include <chrono>
-#include "telemetry.h"
+
 
 namespace xmrstak
 {
diff --git a/xmrstak/misc/telemetry.hpp b/xmrstak/misc/telemetry.hpp
index 0538090011c57195b389a1f02a96b7359a681791..b35bbbfd6fc271fd7a4db5bef5bb91c78ecb1d1b 100644
--- a/xmrstak/misc/telemetry.hpp
+++ b/xmrstak/misc/telemetry.hpp
@@ -1,6 +1,7 @@
 #pragma once
 
 #include <cstdint>
+#include <cstring>
 
 namespace xmrstak
 {
diff --git a/xmrstak/net/jpsock.cpp b/xmrstak/net/jpsock.cpp
index d2873751d35e1ca3cbc41d6afc8b8a9625fe160b..ae20e5221220c4ecda23130e25ac46c77e2ab194 100644
--- a/xmrstak/net/jpsock.cpp
+++ b/xmrstak/net/jpsock.cpp
@@ -24,15 +24,15 @@
 #include <stdarg.h>
 #include <assert.h>
 
-#include "jpsock.h"
-#include "executor.h"
-#include "jconf.h"
-
-#include "rapidjson/document.h"
-#include "jext.h"
-#include "socks.h"
-#include "socket.h"
-#include "version.h"
+#include "jpsock.hpp"
+#include "socks.hpp"
+#include "socket.hpp"
+
+#include "xmrstak/misc/executor.hpp"
+#include "xmrstak/jconf.hpp"
+#include "xmrstak/misc/jext.hpp"
+#include "xmrstak/version.hpp"
+
 
 #define AGENTID_STR XMR_STAK_NAME "/" XMR_STAK_VERSION
 
diff --git a/xmrstak/net/jpsock.hpp b/xmrstak/net/jpsock.hpp
index 4baaade9edd8e4476a016ef90ce51e1838eb969b..c2194ad0da32f3b19135d71cfe0049b8f1900149 100644
--- a/xmrstak/net/jpsock.hpp
+++ b/xmrstak/net/jpsock.hpp
@@ -1,11 +1,13 @@
 #pragma once
+
+#include "msgstruct.hpp"
+
 #include <mutex>
 #include <atomic>
 #include <condition_variable>
 #include <thread>
 #include <string>
 
-#include "msgstruct.h"
 
 /* Our pool can have two kinds of errors:
 	- Parsing or connection error
diff --git a/xmrstak/net/msgstruct.hpp b/xmrstak/net/msgstruct.hpp
index f3a39b250d1b7d12e04b81de9bdf8ac8b4e0e607..05d15fe24d9da381437f721dc8d6299ccd3fcbdf 100644
--- a/xmrstak/net/msgstruct.hpp
+++ b/xmrstak/net/msgstruct.hpp
@@ -1,4 +1,5 @@
 #pragma once
+
 #include <string>
 #include <string.h>
 #include <assert.h>
diff --git a/xmrstak/net/socket.cpp b/xmrstak/net/socket.cpp
index 52f46b546c98603ee70da81f060340701bab4719..b93376e89cd272bc81c7da04a773b5fc86679d74 100644
--- a/xmrstak/net/socket.cpp
+++ b/xmrstak/net/socket.cpp
@@ -21,11 +21,11 @@
   *
   */
 
-#include "socket.h"
-#include "jpsock.h"
-#include "jconf.h"
-#include "console.h"
-#include "executor.h"
+#include "socket.hpp"
+#include "jpsock.hpp"
+#include "xmrstak/jconf.hpp"
+#include "xmrstak/misc/console.hpp"
+#include "xmrstak/misc/executor.hpp"
 
 #ifndef CONF_NO_TLS
 #include <openssl/ssl.h>
diff --git a/xmrstak/net/socket.hpp b/xmrstak/net/socket.hpp
index 94bbf034b9954c129035c2bf9790bf9f4725e758..192a32c2ea98c81e53f5eae0c0c19312ff2ccd1b 100644
--- a/xmrstak/net/socket.hpp
+++ b/xmrstak/net/socket.hpp
@@ -1,5 +1,7 @@
 #pragma once
-#include "socks.h"
+
+#include "socks.hpp"
+
 class jpsock;
 
 class base_socket
diff --git a/xmrstak/net/socks.hpp b/xmrstak/net/socks.hpp
index 82bfa2fcc57794c90f5f631f8e50c99c87c47e4a..1d25d3ab7ec08b0aae9ca1fd946218e98abe041e 100644
--- a/xmrstak/net/socks.hpp
+++ b/xmrstak/net/socks.hpp
@@ -1,4 +1,5 @@
 #pragma once
+
 #ifdef _WIN32
 #ifndef _WIN32_WINNT
 #define _WIN32_WINNT 0x0601  /* Windows 7 */
@@ -7,6 +8,7 @@
 #include <ws2tcpip.h>
 #include <windows.h>
 
+
 inline void sock_init()
 {
 	static bool bWSAInit = false;
diff --git a/xmrstak/params.hpp b/xmrstak/params.hpp
index 92d0da058f10d1b3cebf962eee0094d83540b064..3d6a0ab8be86f5d004191d4e00f7ffc348163547 100644
--- a/xmrstak/params.hpp
+++ b/xmrstak/params.hpp
@@ -1,6 +1,8 @@
 #pragma once
+
+#include "xmrstak/misc/environment.hpp"
+
 #include <string>
-#include "Environment.hpp"
 
 namespace xmrstak
 {