refactored loader to load off file object