Abstract out parsing url for params into a function.