common loader code