Misc refactoring and warnign removal
Merge remote-tracking branch 'origin/master'