refactor to modern obj-c constants and indexing