Changed 'key' index to 'id' for model use