understanding the retrieve function