Made some changes to dealing with encryption and signing