clean up code, and add z_spacing argument and behavior: