Fixed shutdown race condition, and cleaned up sms sender.