add download function
add output methods for return and save