Abstract away soda, tray equality
Add some transaction queries
Redesign database functions around values instead of pointers.

This makes comparing between things returned from the database much
easier, and it lessens the need to check for missing pointers. There's
not too much overhead and it makes our lives so much easier.