Cleaned up initialization logic.