Turn id to index integer instead of hash value

I try to improve efficiency turning the id to indexed integer.