calcIndex passes tests