optimizate the performance of the set operations when the size of data is smaller
restructure the code
restructure the code
restructure the code