Implement index operators

Closes #1