Support for a custom primary key

Not much needed to change, considering.