added database class, updated some files to use new class