Modified how to extract info from DB