upload button and refactoring