make retrieval of sorted sets generic