Added error message reset when failed download is restarted; cleaned up code