rework so that we minimize z moves