Improve variable indexing