add terminal option and clean up