Cleaned & corrected exit behavior.
Cleaned up dialog code.
Corrected debug shell behavior.