Initialization and modeline setup refactorings and tests.