Modified to handle URL input