refactoring and adding download button