Added buildUrl function, added mocha test.