Refactoring and Encryption

Working on refactoring stuff as well as implementing the encryption API
and the default underlying message encryption.