Encryption&email refactor