Minor changes

Mostly minor changes to make code more compliant with
proper coding style, also some repetitions are removed.
8 files changed