Added directory logic on encription