Introduce smarter url_for function.

This should enable looser coupling in the future.