Fixed loader
Some refactoring