better modularized how we read objects from the database