simplified example
added tests
better url resolving