new version with encryption