changing to db instead of flat file