updated sms processing logic