Get the database cookbook working (still needs tweaking)