add DB handling

and some style fixes