refactoring and worked on file upload