adapt export functionality: new url, better error handling, some refactoring