refactoring Loader, cleanup