Some better startup logic.