Rework database to store more detail.
Rename retrieval code.