refactored loader, avoid complex code