Improved handling of list indexing + bug fixes