Fixes and closes #216 by adding buildCustomURL(uri) as requested. With tests.