updated retrieval code