Fix 1.7 compile errors... Need to refactor stuff tomorow
Some refactoring
Merge branch '1.7' into develop
Merge remote-tracking branch 'origin/develop' into develop