Split Android code into separate functions
Independent thread for write and download (Android)