Fix build on windows
Building the software on windows was broken due to link problems. This change fixes the problem and also resolves some circular dependencies. Some features still need to be fixed. They have been marked with todo entries "port to new model code".
It needs to be checked, that this change also builds on MacOS.