remove unwanted files and applying some validations