a little more complex if we want to keep the z coords