Compile error fixes, removing unused legacy code