updated fetch function