code refactored & file encryption/decryption implemented