Core cleanup - Combination of other pullrequests
Since the other stuff was all depending on each other i opened this one with the different commits together. This prevents me from rebasing and fixing conflicts of the other parts. All the stuff was a bit wired together so i would have ended up rewriting some areas multiple times.