Working driver with pointer to db

This allows better structuring of the code