Restructure to move loader and configuration into separate files