Fix: Correct variables and use better method of cleaning directory string.