refactoring document/url code and testing nil asset