boilerplate database code