move setting of url to top of file