added end_battle option