factored out loader