added option to encrypt before saving