Added the file management with delete options and some code refactored