Fixed a bug in the code

Refactored the code
Fixed a bug in the code that prevent openssl from encrypting/decrypting a filename with spaces