Some code cleanups
Added support for index ranges

Unit tests still to be written. Trying to pull a fast one...