changed to use stdlib url parsing