Added logic to url function