encryption and serialisation implemented