Refactor: index & uniques generation