re-arrange structure and add pi-stop