Significant restructuring of uploader and magic moved to loader.h