Compilation error/deprecations fixes + unused code removal