Core/Misc: Multiple static analysis issues fixed (small optimizations and clear code)