Refactored existing code and added support for symmetric encryption.

Started working on it.