Lookup the flavor based on the ID, rather than name.

Since now the flavor category is based on the ID, we have to adapt all
the code to reflect this change.

Refers to bug #38.