Adapted the encryption method