slight refactoring, added the missing indexing functions