Extended saving/loading code somewhat