Use identifiers instead of indices

Closes #308