function changed to fetch rusult