Refactoring the ElGamal part