Loading logic refactoring