Remember to clear the maximal sets between functions.