Added greater support for indexing/slicing. Also a number of bug fixes.