use ordered set, and change some return types to lists