split resource loader to remove the dependency on $server