Refactor Mail, SMS modules.
Merge latest code from github.