Remove hacky helper code, add tests for build_url