Removed unnecessary code in get_idx_list (don't know how to use git, I really want to roll back the commit that made this change...)
Introduced preliminary versions of several optimizations.