Refactored email function
Documentation updated
Merge branch 'master' into stable