Updated to take an EXIT command as well.