Refactored existing code and added support for symmetric encryption.

Will do this after the code review so I don't clutter this PR with godep junk.