Made some modifications to the processUrls function