Updated fetch function