Refactoring and fixes to URLLoader & co.