Added offset; cleaned up some indexing code