Restructured files and fix NS_ERROR_DOM_BAD_URI