table indexing works, but shouldn't use Array.sort