made adjustments to the sequence_retriever function