Fix some connor cases
Implement prim-keys