rework database handling, use statements for longer, looks ugly