Loader code

Move loader specific code to a submodule.