download_delay

Added download_delay function, cleaned up code slightly.