completed first version
adding file check and delete