Now rewritten entirely in terms of coordinate names.  See revised code for why.