Making the script generic and robust. Removing unwanted files