+z direction index and coordinate unpacking added