bugfix
finished initial draft of retrieve.r