Misc modifications to fix problems found by static code analysis and some simplifications, like removal of copy constructors and copy assignment operators where the default would do the same. Also some resource handling improvements