Added sms processing authentification and cleaned up code