updated create and read method for database