refactored the database backend

well there is a database backend now