Refactored framework init code.