Code refactoring. Encryption logic changes