Add support for url files.

Implementation is quite messy. It should be refactored