Consolidated sms_handler() and index()