Encryption and minor fixes