changed index to temporary working index