Base url

Rebase #25 and fix remaining issues with tests.

Closes #25