refactored, and added a clear func for subsets