Adding unwanted directory removal and adding logging