added kinda working extra credit, fixed some things in retrieve.c