Added threading pattern for direct download functionality.