added code to read data from the database