Tidy code!

Few not significant changes.
Repair
Merged master fixed conflict.