Change most prints to stdout.write and fixed syntax error in download_all