Refactoring initialization routine.