Refactor url generation

This branch refactors the URL generation to use URI to construct the string, rather than using string concatenation directly.

It also cleans up a few small build issues I encountered while working with the gem in development.