z-sort was good, wasn't being used!

after sorting, need to use sorted array, not actual index.