Refactoring of scala_compile.py and related code.