fix for issue #50; a lot of refactoring, mainly to do with the code
expecting files instead of abstract URLs in a lot of places...