gui fix + debug settings for CMakeLists.txt
some refactoring
merged master, again