Added z index sorting