add completed
getIndex completed with test cases