added optimization  to fetch the data