Set of fixes for issues identified by cppcheck
Remove a bunch of dead code identified by cppcheck