wrangling with relative urls
decomposed the problem. with tests
fixed encoding issues
some cleanup