fetch.c added free()s and revised code