Fixed code issues as requested in PR2801

Mostly coding style issues
Re-tested in testbed - output as expected