refactor loading