Bunch of refactorings to CoreCompiler prototype