added ability to read and write from and to the database