Core/Scripts: rename files, remove whitespace and some other small changes after recent pull requests
Core/Misc: Refactor scripts to fix static analysis warnings

First batch of fixes targeting 100 issues reported by Coverity