-fixed formating and small optimizations
Merge pull request #5350 from bagobor/patch-1

Code format fix and small optimizations.