Loader module and other refactoring